From c0f01353730feeee66cc6fb84f882e1e8cc3f937 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Tue, 17 May 2022 10:09:13 +0200 Subject: [PATCH] #2691: Do not use AssemblyDefintion.GetAssemblyName(). This fails in culture-invariant mode (ilspycmd) when trying to work with satellite assemblies, because System.Reflection.AssemblyName tries to retrieve CultureInfo of the assembly culture. --- .../Metadata/DotNetCorePathFinderExtensions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ICSharpCode.Decompiler/Metadata/DotNetCorePathFinderExtensions.cs b/ICSharpCode.Decompiler/Metadata/DotNetCorePathFinderExtensions.cs index e391ab1e24..9e31cf9c90 100644 --- a/ICSharpCode.Decompiler/Metadata/DotNetCorePathFinderExtensions.cs +++ b/ICSharpCode.Decompiler/Metadata/DotNetCorePathFinderExtensions.cs @@ -73,13 +73,13 @@ public static string DetectTargetFrameworkId(this MetadataReader metadata, strin if (metadata.IsAssembly) { - var thisAssemblyName = metadata.GetAssemblyDefinition().GetAssemblyName(); - switch (thisAssemblyName.Name) + AssemblyDefinition assemblyDefinition = metadata.GetAssemblyDefinition(); + switch (metadata.GetString(assemblyDefinition.Name)) { case "mscorlib": - return $".NETFramework,Version=v{thisAssemblyName.Version.ToString(2)}"; + return $".NETFramework,Version=v{assemblyDefinition.Version.ToString(2)}"; case "netstandard": - return $".NETStandard,Version=v{thisAssemblyName.Version.ToString(2)}"; + return $".NETStandard,Version=v{assemblyDefinition.Version.ToString(2)}"; } }