I'm trying to make this example work
http://www.simple-talk.com/dotnet/.net-tools/hosting-.net-reflector-in-your-own-application/

and it does actually, except one thing.
It does show IL, Visual Basic source perfectly but when I set the language code = 1 (C#), the writer method throws null reference exception.
IMethodDeclaration alternateMethodDeclaration =
                  translatorManager.CreateDisassembler("", "").
                         TranslateMethodDeclaration(methodDeclaration);
this one -->writer.WriteMethodDeclaration(alternateMethodDeclaration);

Did I miss something important?
Please help.

Thanks in advance!
InOrder
0

Comments

2 comments

  • Clive Tong
    Hi.

    There are two additional properties that the C# language writer is looking for in the LanguageWriterConfiguration.

    One for setting the number format
                configuration["NumberFormat"] = "Decimal"; // "Hexadecimal"
    

    and one for determining if the writer should output C# 4 constructs in a couple of circumstances
                configuration["Optimization"] = "4.0"; // "2.0"
    
    Clive Tong
    0
  • InOrder
    :D
    It did the job.

    Thanks a lot!
    InOrder
    0

Add comment

Please sign in to leave a comment.