简体   繁体   中英

how to make ILspy c# decompile result have better format?

ILspy is a amazing tool, but when I use it decompile dll, I have result like this:

this.lastOrientation = base.get_Orientation();

but what it should be is like this:

this.lastOrientation = base.Orientation;

how can I get the better result?

more examples like this:

It shall be:

battery_logo.Visibility = System.Windows.Visibility.Visible;

but what we get is:

battery_logo.set_Visibility(System.Windows.Visibility.Visible);

When we build will get error like:

'System.Windows.UIElement.Visibility.set': cannot explicitly call operator or accessor

There is a bug report here: https://github.com/icsharpcode/ILSpy/issues/380

Someone wrote:

It turns out the issue was related to missing dependency assembly an the base type. I no longer see that issue. I am stymied on some obfuscated code though, not sure if you'd be interested in helping me work through that but I'd sure appreciate the help.

You said that you are decompiling an app for Windows Phone. What you could try is loading the referenced assemblies of Windows Phone in ILSpy

ILspy is a amazing tool, but when I use it decompile dll, I have result like this:

 this.lastOrientation = base.get_Orientation(); 

but what it should be is like this:

 this.lastOrientation = base.Orientation; 

Orientation is probably a property and Properties in c# are actually kind of syntactic sugar and they internally simply translated to getter & setter methods under the hood - This is why you see the decompiled code as if it was a call to a method and a read of a regular property.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM