This is simply not true. In "most cases" they pretty much do the same
thing.
Actually, Reflector supports Whidbey so given the title of this post
Decompiler.net doesn't handle "most cases" at all
Scott,
Please provide examples rather than making general statements which
are unsupported. The tools do not generate the same output in most
cases. I can provide many examples where Decompiler.NET generates
higher level code that also runs correctly that Reflector 4.0 is
unable to handle correctly. For example, Reflector cannot decompile
the ILReader library correctly written by it's auther where
Decompiler.NET generates code which compiles and runs correctly.
Decompiler.NET also does a much better job with unsafe and COM Interop
code, and is much better at eliminating gotos, merging branches, and
finding higher level constructs like using and foreach statements,
etc.
Whidbey is not yet released, but Decompiler.NET will support Whidbey
2.0 extensions soon at that time or soon thereafter. Since it is a
commercial product, Jungle Creatures, Inc. also provides better
support and fixes any code generation issues as soon as they are
reported. The same is not true regarding non-commercial products like
Reflector. I have reported more than 5 code generation issues that
have not yet been corrected although Reflector 4.0 is much more
complete than previous versions of it.
Please provide a specific non-Whidbey example of code which Reflector
or any other decompiler handles correctly that Decompiler.NET does
not. I can provide many where Decompiler.NET works correctly and none
of the other decompilers avaiable including the other commercial ones
handle correctly.
Try the following example if you don't believe me:
unsafe static bool unsafePointer(string s) {
char[] c = new char[10];
s.CopyTo(0,c,0,10);
fixed(char *p=c){
*(p+5) = 'x';
for (int i = 0; i < 10; i++)
if (*(p+i) == 'p')
return true;
}
return false;
}
Reflector produces code that is incomplete, incorrect, won't compile,
and won't run correctly even if it did:
private static bool unsafePointer(string s)
{
int num1;
char[] chArray1 = new char[10];
s.CopyTo(0, chArray1, 0, 10);
pinned ref char local1 = ref chArray1[0];
local1[10] = 120;
for (num1 = 0; (num1 < 10); num1 += 1)
{
if ((local1 + (num1 * 2)) == 112)
{
return true;
}
}
local1 = 0;
return false;
}
Decompiler.NET however, produces even better code than the original
that also compiles and runs correctly.
static unsafe bool unsafePointer (string s)
{
char[] c;
c = new char[10];
s.CopyTo (0, c, 0, 10);
fixed (char* p = c)
{
p[5] = 'x';
for (int i = 0; (i < 10); i++)
{
if (p
== 'p')
{
return true;
}
}
}
return false;
}