Competition: What’s your favorite Redgate tool? Enter now.

'Generate debugging information' breaks file header

CSXPJCCSXPJC Posts: 19
edited February 6, 2015 8:10PM in SmartAssembly
I have a .NET 3.5 assembly that I am obfuscating with SA 6.8. If I enable the "generate debugging information" feature the header of the resulting assembly is invalid.

After obfuscation the header (dumpbin /headers <myAssembly>) gives the following (assembly name altered).
Debug Directories

        Time Type       Size      RVA  Pointer
    -------- ------ -------- -------- --------
    00000000 cv           5E 00064010    62210    Format: RSDS, {BBC3FDC6-F44A-40B2-9321-527B3BBE7EBF}, 1, C:UsersmeDesktopObfMyAssembly.pdb
    BBC3FDC6 (7B522193) BF7EBE3B 00000001 555C3A43D:CheckoutsSCIntegrationABCMyAssembly.dll : fatal error LNK1106: i
nvalid file or disk full: cannot seek to 0x555C3A43

If I leave all other obfuscation options the same but turn off the "generate debugging information" then the headers are fine. The headers are also fine in the assembly before obfuscation.
Debug Directories

        Time Type       Size      RVA  Pointer
    -------- ------ -------- -------- --------
    54D4ADD2 cv          11C 00075854    73A54    Format: RSDS, {7D34FE79-32F0-46E0-B5DE-46C2225E6D23}, 146, d:CheckoutsSCIntegrationABCobjDebugMyAssembly.pdb

Not surprisingly the assembly with the broken header fails when I try and use it:
Unable to create instance of class MyUnitTests.Test. Error: System.TypeInitializationException: The type initializer for '&lt;Module&gt;' threw an exception. ---&gt; System.InvalidProgramException: Common Language Runtime detected an invalid program.

Comments

  • The 'breaking' of the header information appears to not be related to my problem of the assembly failing to load and the CLR complaining about it not being a valid program. :(

    My problem seems to have been solved by turning off the 'manage memory' option. By doing so I can also enable 'control flow obfuscation' at maximum strength whereas before having 'control flow obfuscation' enabled at all on the main assembly cased SmartAssembly to fail to obfuscate the assembly.
Sign In or Register to comment.