From 32a0fa70f7df33ae973ff35970d9e6131fedda0b Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Wed, 28 Nov 2018 20:39:37 -0800 Subject: [PATCH] Replace private System.AppDomain reflection with a regular call Fixes dotnet/cli#10399 --- TestAssets/TestPackages/dotnet-portable/Program.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/TestAssets/TestPackages/dotnet-portable/Program.cs b/TestAssets/TestPackages/dotnet-portable/Program.cs index 1c8fb26e7..02d81ba5c 100644 --- a/TestAssets/TestPackages/dotnet-portable/Program.cs +++ b/TestAssets/TestPackages/dotnet-portable/Program.cs @@ -13,19 +13,10 @@ namespace ConsoleApplication { Console.WriteLine("Hello Portable World!"); - var depsFile = new FileInfo(GetDataFromAppDomain("FX_DEPS_FILE")); + var depsFile = new FileInfo(AppContext.GetData("FX_DEPS_FILE") as string); string frameworkVersion = depsFile.Directory.Name; Console.WriteLine($"I'm running on shared framework version {frameworkVersion}!"); } - - public static string GetDataFromAppDomain(string propertyName) - { - var appDomainType = typeof(object).GetTypeInfo().Assembly?.GetType("System.AppDomain"); - var currentDomain = appDomainType?.GetProperty("CurrentDomain")?.GetValue(null); - var deps = appDomainType?.GetMethod("GetData")?.Invoke(currentDomain, new[] { propertyName }); - - return deps as string; - } } }