locked
Dotfuscator causing exception? RRS feed

  • Question

  • I have an app developed in VB.Net, to which I have applied the Dotfuscator supplied with VS2010. After building the obfuscated version, all I did was replace the EXE file on the target machine with the obfuscated EXE file. This appeared to be working fine. But I have just had an exception in the app when using pne particular part of it, saying that it cannot find a method on an object. If I swap back to the un-obfuscated EXE file, the exception does not happen. Is there something else I need to do besides replacing the EXE file? Or is it possible that the obfuscation process has somehow corrupted my EXE? I am VERY dismayed by this!
    Steve M
    • Moved by Alexander Sun Monday, October 24, 2011 7:49 AM Dotfuscator problem (From:Visual Studio Setup and Installation)
    Saturday, October 22, 2011 10:00 AM

Answers

  • There are some traps in using obfuscation. Without seeing the exact error, I'm guessing that you have fallen into one of the following two.

     

    1. You are using reflection to use a string to invoke a method by its name (something like ObjectType.GetMethod("MyMethod"...). After Dotfuscator has renamed the method, it will no longer match the string.

    or...

    2. You have an abstract method in ClassA which you provide in the derived class ClassB but don't actually call anywhere. Dotfuscator will remove the method from ClassB, thinking that it's clever to remove unused code, but your program will crash at runtime telling you that you must provide the derived version of the abstract class (even if it's never used).

     

    The solution to the first problem is to remove the method in question from the obfuscation. The solution to the second is to switch off the option to remove unused code.

    Monday, October 24, 2011 2:21 AM
  • Hi Steve,

     

    Welcome to the MSDN forum.

     

    I am sorry that this queue is about Visual Studio Setup and Installation. Your problem is related to Dotfuscator, so, for better support, I recommend you go to the Dotfuscator forum to ask for help.

    Dotfuscator forum: http://www.preemptive.com/forum/

     

    Sorry for any inconvenience.

     

    Best Regards,


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, October 24, 2011 7:48 AM

All replies

  • There are some traps in using obfuscation. Without seeing the exact error, I'm guessing that you have fallen into one of the following two.

     

    1. You are using reflection to use a string to invoke a method by its name (something like ObjectType.GetMethod("MyMethod"...). After Dotfuscator has renamed the method, it will no longer match the string.

    or...

    2. You have an abstract method in ClassA which you provide in the derived class ClassB but don't actually call anywhere. Dotfuscator will remove the method from ClassB, thinking that it's clever to remove unused code, but your program will crash at runtime telling you that you must provide the derived version of the abstract class (even if it's never used).

     

    The solution to the first problem is to remove the method in question from the obfuscation. The solution to the second is to switch off the option to remove unused code.

    Monday, October 24, 2011 2:21 AM
  • Hi Steve,

     

    Welcome to the MSDN forum.

     

    I am sorry that this queue is about Visual Studio Setup and Installation. Your problem is related to Dotfuscator, so, for better support, I recommend you go to the Dotfuscator forum to ask for help.

    Dotfuscator forum: http://www.preemptive.com/forum/

     

    Sorry for any inconvenience.

     

    Best Regards,


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, October 24, 2011 7:48 AM