Search code examples
c#decompilingreflectordecompiler

How to make Reflector not Choke on new syntax


Is there a way to make reflector disassemble back to the new c# constructs?

Auto-Implemented properties are coming out like this:

[CompilerGenerated]
private string <TypeName>k__BackingField;
 public string TypeName
 {
     [CompilerGenerated]
     get
      {
         return this.<TypeName>k__BackingField;
      }
      [CompilerGenerated]
      private set
      {
          this.<TypeName>k__BackingField = value;
      }
 }

Generic Types with Strings ints or objects come out wrong:

Tuple<User,String><User,string>

Not to mention the confusing enumerators that are generated in response to some lambda based code.

Any Ideas? Getting back to the original form would be great, but getting to an equivalent compilable state would be a huge step forward. The above examples aren't valid C# code.


Solution

  • As regards auto-implemented properties, they come out fine (i.e. as get; set; without the compiler-generated backing-field) in the latest version. Just make sure you set Optimization to .NET 3.5 or .NET 4.0 in View -> Options -> Disassembler.