Obfuscate Assembly and Reflection

amirhosseinab picture amirhosseinab · Sep 15, 2011 · Viewed 9.1k times · Source

I want to obfuscate my assembly files (*.dll, *.exe) by Dotfuscator. my question is if I do this, can I still use classes and types that are in those assemblies by their original names (I mean names before obfuscation) and using System.Reflection methods to work with them?

If you need more detail,please tell me

Answer

Patrick Desjardins picture Patrick Desjardins · Sep 15, 2011

Obfuscation are Reflection can cause you some problem. Even if you take the suggestion to use option to not obfuscate public method, some of the reflected code may call private method. The problem is that obfuscation will change name of some code that you may need to stay the same.

If you know or can locate the region that is susceptible to be used with reflection you can use

[global::System.Reflection.Obfuscation(Exclude=true, Feature="renaming")]

This will tell the obfuscator to keep the name.

Running obfuscation with reflection require more testing that's for sure but still possible...