3

I'm using a Scripting system that compile at runtime, it is working good, but when I use some code obfuscator to hide my codes from "bad guys" the scripting stop to work, it returns an error:

Error: CS0234

The type or namespace name "Objects" does not exist in the namespace "TestProgram" (are you missing an assembly reference?)

Error: CS0246

The type or namespace name "Scripter" could not be found (are you missing a using directive or an assembly reference?)

Do you know if there is a way to fix it? I tried a lot of obfuscators, and look's like that all does the same thing with my scripter.

Community
  • 1
  • 1
Kyore
  • 388
  • 2
  • 7
  • 29

1 Answers1

2

You most likely need to not obfuscate the public types your "scripts" try to access.

This can be done with most better obfuscators by including the appropriate attribute (ObfuscationAttribute) with the Exclude property set to true on the types or methods as needed: [Obfuscation(Exclude=true)]


Edit:

You would use this attribute by decorating the appropriate types, as needed, ie:

[Obfuscation(Exclude=true, ApplyToMembers=true)]
public class Objects
{
    // ... 

This will cause most obfuscators (though some require configuration to pay attention to this attribute) to not obfuscate the type. Some obfuscators will obfuscate the internal members, but not obfuscate the public API. This depends on the actual tool you are using, and I would recommend seeing their documentation for specifics.

Reed Copsey
  • 554,122
  • 78
  • 1,158
  • 1,373
  • Thank you, but can you give me an exemple how to use it? Cuz I didn't understand it right. – Kyore Jan 31 '12 at 12:41
  • Thanks, look's like it's working, but now my code is exposed, do you know some software that can help me with Debbuguers and Reverse Engineer(Reflector) ? – Kyore Jan 31 '12 at 18:11
  • @user1179274 What obfuscator are you using? Some obfuscators will still obfuscate the implementation, but not the API... – Reed Copsey Jan 31 '12 at 18:18
  • I'm using Eazfuscator, it's not revealing everything, but still possible to check some methods since I have to set the obfuscator to not ofuscate that class. I'm thinking about Themida, but I tested in the Demo version but it's blocking my app for some reason, returning this message: "CS0009 - Metadata file 'PrograPath\TestProgram.exe' could not be opened" – Kyore Jan 31 '12 at 19:16
  • @user1179274 I've had good luck with the Eziriz products for this type of thing - but haven't tested either of those... – Reed Copsey Jan 31 '12 at 19:23