C++/CLI add-in for .NET Reflector

If you don’t know that tool yet, stop reading and … stop reading … and download it from http://www.aisto.com/roeder/dotnet/. This is a must have for any serious .NET developer.

Actually one of the very first things I do after installing VS.NET 200x is to add it as the first tool under the Tools menu in the IDE.

Title: .NET Reflector
Command: D:\Bits\NET Reflector\Reflector.exe
Arguments: $(TargetPath)
Initial Directory: $(TargetDir)

I use it all the time to better understand what the C# and the C++/CLI compilers generate and to look at our “own source code”, disassembled. The second one I put down there is ILDasm.

Now, imagine my joy when Dean offered me to be alpha tester for his .NET Reflector C++/CLI Add-in! Although I have not tried that yet, he tells me it supports function-try-block!

An example from System::Text::StringBuilder::Append:

System::Text::StringBuilder^  Append(System::String^ value)
      if (value != nullptr)
            System::String^ text1 = this->m_StringValue;
            System::IntPtr ptr1 = System::Threading::Thread::InternalGetCurrentThread();
            if (this->m_currentThread != ptr1)
                  text1 = System::String::GetStringForStringBuilder(text1, text1->Capacity);
            int num1 = text1->Length;
            int num2 = (num1 + value->Length);
            if (this->NeedsAllocation(text1, num2))
                  System::String^ text2 = this->GetNewString(text1, num2);
                  text2->AppendInPlace(value, num1);
                  this->ReplaceString(ptr1, text2);
                  text1->AppendInPlace(value, num1);
                  this->ReplaceString(ptr1, text1);

      return this;


As soon as this will be ready, he’ll discuss with Lutz to integrate his code into the .NET Reflector. Good times are coming your way. Chapeau Dean!

BTW, I don’t know about you, but I can’t stand this design guideline that says that a nullptr String reference should be treated the same way as a reference to an empty String instance… Open door to hidden bugs if you ask me!

Comments (3)

  1. Uwe Keim says:

    Those "function-try-blocks" are another reason why I and other fellow developers think that Bjarne really really created a monster.

    I really really hope C# behaves better as new versions are released.

  2. yvesdolc says:

    Danke Uwe.

    The truth is I’m eager to see C# 3.0 and LINQ hit the road but I would never stop developing in C++/CLI. And wait till you see the future version of C++/CLI!

    Between you and me (no one else is reading this right?), I’ve never use a function-try-block.

    Haben Sie einen schönen Tag!