Files
ILSpy/ICSharpCode.Decompiler
Siegfried Pammer e85d2ba00e Detect local functions renamed by obfuscators
Obfuscators strip the CompilerGeneratedAttribute and rewrite the
"<caller>g__name|x_y" name, which is all IsLocalFunctionMethod had to go on.
The method then stays an ordinary static method, its display struct escapes by
ref into a plain call, and TransformDisplayClassUsage correctly refuses to
scalar-replace it -- so the closure fields leak into the output as
"<>c__DisplayClass29_0_.iid" (issue #3202).

The one marker an obfuscator cannot remove is the signature: Roslyn emits
struct closures exclusively for local functions, and no hand-written C# can
name a "<>c__DisplayClass" type, so a by-ref parameter of one identifies the
method regardless of what it is called.

#3202

Assisted-by: Claude:claude-opus-5[1m]:Claude Code
2026-08-27 10:25:26 +02:00
..
2025-12-29 19:24:31 +01:00