ConfuserEx: System.TypeInitializationException on Mono

时间:2016-08-31 12:17:16

标签: c# mono confuserex

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

2 个答案:

答案 0 :(得分:8)

我对单个C#类使用了最大混淆级别,这个级别甚至没有使用,但它是所需的外部库的一部分,这似乎是问题所在。

当我将混淆级别降低到“激进”时,它可以正常工作。不理想,但现在会做。

答案 1 :(得分:0)

我还设置了“防调试”和“防篡改”保护措施。而且它对我有用。

<protection id="anti debug" action="remove"/>
<protection id="anti tamper" action="remove"/>