-
-
Notifications
You must be signed in to change notification settings - Fork 395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect decompiled code (missing casts) #244
Comments
seems also related to the version of ILSPY engine. |
Hi, the issue you are facing is a known limitation of the current decompiler engine. the engine is simply incapable of inserting the missing object casts there as it cannot predict the produced C# code will reference the correct member. Modern versions of ILSpy implement a sort of resolver that implements the C# member resolution specification. Using this resolver they can determine if additional casts need to be inserted or if additional qualifications on member references are needed. Implementing such analysis logic in the current ILSpy 2.4 engine would be hard so this problem will likely be fixed when dnSpy moves to the newest ILSpy decompiler engine in the future. Progress on that is tracked by issue #5 as mentioned by @funkvps. |
dnSpyEx version
6.4.1
Describe the Bug
If you compare
System.String.Equals(string, string)
between reference code, dnSpyEx and ILSpy, you will see some functional differences. While this is a specific case, other examples exist that are similar:Reference .NET code
dnSpyEx
ILSpy 8.1.0.7455
How To Reproduce
Just decompile mscorlib .NETFramework v4.0 and compare between ILSpy and dnSpyEx and the reference code at the given url. One problem that arrise is that the dnSpy code looks like a recursion where
String.Equals()
callsString.==
and the other way around:which of course isn't true.
Expected Behavior
The result should make sure the
==
operator is not called on(string, string)
as shown in the code of ILSpy.Actual Behavior
Some casting should be shown in the decompiled code (just like in ILSpy)
Additional Context
No response
The text was updated successfully, but these errors were encountered: