Decompiling .net assembly with dotPeek gives invalid syntax
Asked Answered
T

2

6

I have a problem with decompiling .net assembly. When I open the assembly in dotPeek there is class called frmMain with few hundred variables declared like this:

[SpecialName]
private static int \u0024STATIC\u0024SortByLengthAsc\u002402811241124\u0024xlen;

When i try to export it to project all those lines give errors (STATIC is not defined) even if I change all the \u0024 to $. Am I doing something wrong?

Tailpiece answered 3/11, 2016 at 15:48 Comment(0)
S
3

No, the assembly has been obfuscated to prevent people (like you) to take a peek in the code and possibly 'steal' it. Those variable names are allowed in IL, but not in actual C# code, so that is why it fails.

The only remedy I know is a reverse-obfuscation tool that knows how the obfuscator obfuscates and tries to turn that around. Or you can do it by hand, which will take a lot of time usually, which proves obfuscation pays off.

Seedling answered 3/11, 2016 at 15:49 Comment(4)
The author of the obfuscation package probably has another product that deobfuscates obfuscated code for debug purposesOvercrop
Usually that is true @PanagiotisKanavosSeedling
I will just ask my friend (author of that program) to give me the source code than. Thanks for answerTailpiece
I am seeing similar output after decompiling Microsoft .NET Framework assemblies such as PresentationFramework.dll. I thought those assemblies are not obfuscated, as they are now open source?Nynorsk
D
1

Quick tip for anyone got this question in Google: Try ILSpy (for example) instead of dotPeek.

Got this unicode stuff with dotPeek in a non obfuscated dll, but everything is fine with ILSpy

Dinar answered 21/8, 2022 at 17:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.