c# - Disable "Constant Literals Pruning" in Eazfuscator.NET -


i disable "constant literals pruning" in eazfuscator.net (assembly level). how possible?

background: use enums in custom attribute constructor. type of constructor parameter object, because attribute class in assembly doesn’t reference assembly containing enum.

before obfuscation:

[myattribute(myenum.value3)] public class myclass {  } 

after obfuscation (decompiled):

[myattribute(2)] public class myattribute : attribute {  } 

in constructor of attribute cast value enum. generates exception in obfuscated assembly, not in unobfuscated variant:

public class myattribute : attribute {     public myattribute(object value)     {        var x = (enum) value;    // throws invalidcastexception after obfuscation     } } 

i'm colleague of frans, , thought of following solution. able cast integer enum-value, have pass type of enum.

any thoughts?

[myattribute("description", param1: myownenum.myparticularenumvalue, param2: myownenum.myparticularenumvalue2, passedtype: typeof(myownenum)]

internal class myattribute : attribute {

public myattribute(string description, object param1, object param2, type passedtype) {     this.myattributedescription = description;     this.somepropertywhichisanenum = (enum)enum.toobject(passedtype, param1));     this.someotherpropertywhichisanenum = (enum)enum.toobject(passedtype, param2) } 

}


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -