Very cool... Local variable names?
I've just tried dotPeek quickly and it already looks so much better than Reflector, which is pretty amazing considering Reflector has been in development for years. Two major things I noticed immediately are:
- Sensible generation of switch statements, no GOTOs and labels all over the place
- Sensible local variable names, no CS$xxxxxxx crap
Is there any way to retain the real local variable names? I guess they're thrown away by the compiler but is it possible to retrieve them from a PDB?
Anyway, great job as ever :)
Please sign in to leave a comment.
Having no troubles with local variable names using dotPeek 1.0.0.1219 ... they're the real names.
Maybe you de-compiled an assemlby which is "protected" using Dotfuscator.
--Harald-René Flasch (aka hfrmobile)
Thanks for the reply HFR. It's our own code that I'm decompiling (Framework 2) which isn't obfuscated so it's a bit odd :/
It's http://youtrack.jetbrains.net/issue/DOTP-929
Not sure about fix version yet, 1.0 or 2.0
Brilliant, thanks Leonid
:)Ups ... sorry for the confusion! I just discovered that local variable names are "not working" for me too even when .pdb file is provided!
Haven't seen this since dotPeek already displays correct parameter names of course and already using (more or less) smart names for local variables:
Since Reflector v6 already displays the real local variable names (when there is a .pdb of course) I assume that JetBrains will provide this soon in dotPeek too ;-)
Just for information (compares Reflector 6 with dotPeek 1).
JetBrains dotPeek 1.0: Release DLL + XML
public static byte[] GetIcon(IntPtr iconHandle, bool large, IntPtr[] iconHandlesCombine)
{
bool flag = false;
IntPtr hGdiObject1 = IntPtr.Zero;
IntPtr hGdiObject2 = IntPtr.Zero;
IntPtr num1 = IntPtr.Zero;
IntPtr num2 = IntPtr.Zero;
MemoryStream memoryStream = new MemoryStream();
BinaryWriter binaryWriter = new BinaryWriter((Stream) memoryStream);
try
{
num2 = NativeMethods.GetDeviceContext(IntPtr.Zero);
int num3 = large ? 32 : 16;
int num4 = large ? 32 : 16;
NativeMethods.BitmapInfoHeader pbmi = new NativeMethods.BitmapInfoHeader();
...
}
JetBrains dotPeek 1.0: Debug DLL + PDB:
public static byte[] GetIcon(IntPtr iconHandle, bool large, IntPtr[] iconHandlesCombine)
{
bool flag = false;
IntPtr hGdiObject1 = IntPtr.Zero;
IntPtr hGdiObject2 = IntPtr.Zero;
IntPtr num1 = IntPtr.Zero;
IntPtr num2 = IntPtr.Zero;
MemoryStream memoryStream = new MemoryStream();
BinaryWriter binaryWriter = new BinaryWriter((Stream) memoryStream);
try
{
num2 = NativeMethods.GetDeviceContext(IntPtr.Zero);
int num3 = large ? 32 : 16;
int num4 = large ? 32 : 16;
NativeMethods.BitmapInfoHeader pbmi = new NativeMethods.BitmapInfoHeader();
...
}
.NET Reflector 6: Debug DLL + PDB:
public static byte[] GetIcon(IntPtr iconHandle, bool large, IntPtr[] iconHandlesCombine)
{
bool exceptionOccured = false;
IntPtr dibHandle = IntPtr.Zero;
IntPtr monoDibHandle = IntPtr.Zero;
IntPtr memoryDeviceContextHandle = IntPtr.Zero;
IntPtr deviceContextHandle = IntPtr.Zero;
MemoryStream memoryStream = new MemoryStream();
BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
try
{
IntPtr pointerToBits;
deviceContextHandle = NativeMethods.GetDeviceContext(IntPtr.Zero);
int width = large ? 0x20 : 0x10;
int height = large ? 0x20 : 0x10;
...
}
.NET Reflector 6: Release DLL + XML:
public static byte[] GetIcon(IntPtr iconHandle, bool large, IntPtr[] iconHandlesCombine)
{
bool flag = false;
IntPtr zero = IntPtr.Zero;
IntPtr hGdiObject = IntPtr.Zero;
IntPtr deviceContextHandle = IntPtr.Zero;
IntPtr hdc = IntPtr.Zero;
MemoryStream output = new MemoryStream();
BinaryWriter writer = new BinaryWriter(output);
try
{
IntPtr ptr5;
hdc = NativeMethods.GetDeviceContext(IntPtr.Zero);
int num = large ? 0x20 : 0x10;
int num2 = large ? 0x20 : 0x10;
...
}