Browse Source

Fix #2174: Some compilers produce display class ctors with unused local variables

(cherry picked from commit 71b54e87a0)
release/6.2
Siegfried Pammer 5 years ago committed by Daniel Grunwald
parent
commit
2612a06a11
  1. 6
      ICSharpCode.Decompiler/IL/Transforms/TransformDisplayClassUsage.cs

6
ICSharpCode.Decompiler/IL/Transforms/TransformDisplayClassUsage.cs

@ -442,7 +442,11 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -442,7 +442,11 @@ namespace ICSharpCode.Decompiler.IL.Transforms
if (def.RelativeVirtualAddress == 0)
return false;
var body = file.Reader.GetMethodBody(def.RelativeVirtualAddress);
if (!body.LocalSignature.IsNil || body.ExceptionRegions.Length != 0)
// some compilers produce ctors with unused local variables
// see https://github.com/icsharpcode/ILSpy/issues/2174
//if (!body.LocalSignature.IsNil)
// return false;
if (body.ExceptionRegions.Length != 0)
return false;
var reader = body.GetILReader();
if (reader.Length < 7)

Loading…
Cancel
Save