Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ConfuserEx: System.TypeInitializationException on Mono

I cannot get my obfuscated application running on mono. Unobfuscated works on mono. When I use the .net framework on win7 it starts without issue in both variants.

This is the exception I get:

Unhandled Exception: System.TypeInitializationException: The type initializer for '<Module>' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object at .‮‮‎‫‎âªâ€­â€‹â€ªâ€«âªâ¬â€Žâªâ¯â€«â­â€Œâ€‹â€­â¯â€­â«â¯â¬â€­â€­â«â€Œâ€®â­â«â€­â€ªâ€«â­â€¬â€«â€ªâ€ªâ€® () <0x40884310 + 0x00874> in :0 at ..cctor () <0x40884100 + 0x00017> in :0 --- End of inner exception stack trace --- at Vintagestory.Server.Program.Main (System.String[] args) <0x408814c0 + 0x002bb> in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for '' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object at .‮‮‎‫‎âªâ€­â€‹â€ªâ€«âªâ¬â€Žâªâ¯â€«â­â€Œâ€‹â€­â¯â€­â«â¯â¬â€­â€­â«â€Œâ€®â­â«â€­â€ªâ€«â­â€¬â€«â€ªâ€ªâ€® () <0x40884310 + 0x00874> in :0 at ..cctor () <0x40884100 + 0x00017> in :0 --- End of inner exception stack trace --- at Vintagestory.Server.Program.Main (System.String[] args) <0x408814c0 + 0x002bb> in :0

The exception seems to happen at a point when it has to load additional code from an external library thats also obfuscated in the same process.

How can I even go about and debug/fix this?

Update: Seems to also happen on Windows Mono

Update2: Here is also a github issue entry of the bug with some more detail: https://github.com/yck1509/ConfuserEx/issues/535

like image 958
Tyron Avatar asked Aug 31 '16 12:08

Tyron


1 Answers

I used the Maximum Obfuscation Level for a single C# Class that was not even used but part of an external library that was required, that seemed to be the problem.

When I reduce the obfuscation level down to "Aggressive" it works. Not ideal but will do for now.

like image 189
Tyron Avatar answered Oct 14 '22 19:10

Tyron