From 0df7e1e4a588800b7f4f091b1505cac0feca6551 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Wed, 6 May 2020 22:14:39 +0200 Subject: [PATCH] Fix #1999: Compiler generated variables with weird names; by supporting a newer naming-convention used by mcs for anonymous delegates: See https://github.com/mono/mono/blob/c2795c9cb597901a0b1a7886583cc37bffef1271/mcs/mcs/delegate.cs#L808 --- ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs b/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs index 3fdf9f0ad..92f1594fd 100644 --- a/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs +++ b/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs @@ -366,7 +366,7 @@ namespace ICSharpCode.Decompiler.CSharp static bool IsAnonymousMethodCacheField(SRM.FieldDefinition field, MetadataReader metadata) { var name = metadata.GetString(field.Name); - return name.StartsWith("CS$<>", StringComparison.Ordinal) || name.StartsWith("<>f__am", StringComparison.Ordinal); + return name.StartsWith("CS$<>", StringComparison.Ordinal) || name.StartsWith("<>f__am", StringComparison.Ordinal) || name.StartsWith("<>f__mg", StringComparison.Ordinal); } static bool IsClosureType(SRM.TypeDefinition type, MetadataReader metadata)