Home - Forums-.NET - Spices.Net - Need Property Name

Spices.Net

NET code security, tools to protect, obfuscate, tamper defense, code and data safety, recover, convert, optimize, explore, browse and analyze .Net software.

This forum related to following products: Spices.Net Suite, Spices.Net Obfuscator, Spices.Net Decompiler

Need Property Name
Link Posted: 18-Jan-2007 05:24
I need to obtain the name of an obfuscated property to pass to a data access function. I tried using something like  \"typeof(MyClass).GetProperties()[0].Name\"  however, after obfuscation GetProperties returns a zero length array.  Is there some way to programmatically obtain an obfuscated property name?
Link Posted: 18-Jan-2007 07:56
Probably you're using NonDisplayable mode of naming, in this case it will better if you'll use AlphaNumeric or another readable mode of naming.
Link Posted: 18-Jan-2007 11:01
I am using AlphaNumeric mode. Any other suggestions?
Link Posted: 18-Jan-2007 11:40
What results you receive by using
typeof(MyClass).GetProperties()
?
This statement returns collection of properties?
or
typeof(MyClass).GetProperties()[0]
?
This statement returns a PropertyDescriptor instance?
Link Posted: 18-Jan-2007 14:19
As my original post said \"GetProperties returns a zero length array \".  I've narrowed this down to one Obfuscator option.

If I change \"Optimzer-Properties\" from \"Obfuscate\" to \"None\", then GetProperties will return the Properties as expected.

I don't know if this is expected behavor or not.
Link Posted: 18-Jan-2007 14:32
Thanks for more detailed explanation, currently I understand what's happens.
Optimizer removes properties that obfuscated or all properties to optimize assembly by size.
In this case you can exclude properties from obfuscation of class that you want to use with reflection(you can mark these properties by NotObfuscateAttribute in code, use ExlusionPatterns property to exclude some properties from obfuscation) or turn Optimizer.Properties to None value to avoid this problem.