Open tyronx opened 8 years ago
Here is the static constructor that I see in the decompiled code using dotPeek:
`public static class _fXDVcL5EsSl2qroOUDl3n2bvJUI
{
public static string _1wKDbWmthkUZNtrbPuC6genyfuJ = \u003CModule\u003E.\u202D
static _fXDVcL5EsSl2qroOUDl3n2bvJUI()
{
label_1:
int num1 = -1418751270;
while (true)
{
int num2 = -619600823;
uint num3;
switch ((num3 = (uint) (num1 ^ num2)) % 7U)
{
case 0:
_fXDVcL5EsSl2qroOUDl3n2bvJUI._DkYD7senwKYi1KYMe9vPsZO68fe = _fXDVcL5EsSl2qroOUDl3n2bvJUI.\u200B(_fXDVcL5EsSl2qroOUDl3n2bvJUI._jCSWYeKT8uVDNHhPNycaUM0DIgv(), \u003CModule\u003E.\u202D
What is this stuff with <Modue>.<string>? Is that valid c# syntax?
<Modue>.<string>
is perfectly fine as far as C# syntax is concerned, so it's problably not the issue here. <Module>
is the global type constructor, the very first executed method, way way before the Main method in the Program.cs class. <string>
is a Type, and in-between you have a method named with some unprintable characters, tha's why you don't see them actually.
ConfuserEX include a new stack trace decoder, you can use it to , maybe, understand clearly what is going on :)
Thank you for the response! Is there any documentation on how the stack trace decode works? A quick google search didn't give me any result.
Update: Also happens under Windows Mono. Adjusting title..
Here is the full mono trace where the exception happens:
[000000000000246C: 1.24378 3] ENTER: (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)(0000000000000000, 0000000000000000, 000000000019D500, 000000000424A360, ) [000000000000246C: 1.24380 4] ENTER:
:.cctor ()() [000000000000246C: 1.24540 5] ENTER: :â€â€ªâ€¬â¯â€â€Œâªââ€â®â€Œâ€Žâ€‹âªâ€âªâ€ªâ¬ââ€â€Žâ«â€Œâ€«â€Žâ€Žâ€®â€Žâ€¬â‌‎âªâ€‹â¯â€â€â«â®â¬â€® ()() [000000000000246C: 1.24554 6] ENTER: System.RuntimeType:get_Module ()(this:0000000002C6F160[System.RuntimeType VintagestoryServer.exe], ) [000000000000246C: 1.24563 7] ENTER: System.RuntimeType:GetRuntimeModule ()(this:0000000002C6F160[System.RuntimeType VintagestoryServer.exe], ) [000000000000246C: 1.24577 8] ENTER: (wrapper managed-to-native) System.RuntimeTypeHandle:GetModule (System.RuntimeType)([TYPE: ], ) [000000000000246C: 1.24580 8] LEAVE: (wrapper managed-to-native) System.RuntimeTypeHandle:GetModule (System.RuntimeType)[System.Reflection.MonoModule:0000000002422730] [000000000000246C: 1.24582 7] LEAVE: System.RuntimeType:GetRuntimeModule ()[System.Reflection.MonoModule:0000000002422730] [000000000000246C: 1.24583 6] LEAVE: System.RuntimeType:get_Module ()[System.Reflection.MonoModule:0000000002422730] [000000000000246C: 1.24597 6] ENTER: System.Reflection.MonoModule:get_FullyQualifiedName ()(this:0000000002422730[System.Reflection.MonoModule VintagestoryServer.exe], ) [000000000000246C: 1.24600 7] ENTER: (wrapper managed-to-native) System.Security.SecurityManager:get_SecurityEnabled ()() [000000000000246C: 1.24601 7] LEAVE: (wrapper managed-to-native) System.Security.SecurityManager:get_SecurityEnabled ()result=0 [000000000000246C: 1.24603 6] LEAVE: System.Reflection.MonoModule:get_FullyQualifiedName ()[System.String:00000000024227D0] [000000000000246C: 1.24617 6] ENTER: System.Runtime.InteropServices.Marshal:GetHINSTANCE (System.Reflection.Module)([System.Reflection.MonoModule:0000000002422730], ) [000000000000246C: 1.24644 7] ENTER: (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)(0000000000000000, 0000000000000000, 000000000019C940, 000000000424BF90, ) [000000000000246C: 1.24647 8] ENTER: System.Reflection.Module:.cctor ()() [000000000000246C: 1.24649 9] ENTER: (wrapper alloc) object:AllocSmall (intptr,intptr)(0000000004B3A128, 0000000000000070, ) [000000000000246C: 1.24651 9] LEAVE: (wrapper alloc) object:AllocSmall (intptr,intptr)[System.Reflection.TypeFilter:0000000002422900] [000000000000246C: 1.24653 9] ENTER: (wrapper alloc) object:AllocSmall (intptr,intptr)(0000000004B3A128, 0000000000000070, ) [000000000000246C: 1.24654 9] LEAVE: (wrapper alloc) object:AllocSmall (intptr,intptr)[System.Reflection.TypeFilter:0000000002422970] [000000000000246C: 1.24656 8] LEAVE: System.Reflection.Module:.cctor () [000000000000246C: 1.24657 7] LEAVE: (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)[OBJECT:0000000000000000] [000000000000246C: 1.24659 7] ENTER: System.Reflection.Module:op_Equality (System.Reflection.Module,System.Reflection.Module)([System.Reflection.MonoModule:0000000002422730], 0000000000000000, ) [000000000000246C: 1.24660 7] LEAVE: System.Reflection.Module:op_Equality (System.Reflection.Module,System.Reflection.Module)result=0 [000000000000246C: 1.24676 7] ENTER: (wrapper managed-to-native) System.Reflection.Module:GetHINSTANCE (System.Reflection.Module)([System.Reflection.MonoModule:0000000002422730], ) [000000000000246C: 1.24678 7] LEAVE: (wrapper managed-to-native) System.Reflection.Module:GetHINSTANCE (System.Reflection.Module)result=-1 [000000000000246C: 1.24680 6] LEAVE: System.Runtime.InteropServices.Marshal:GetHINSTANCE (System.Reflection.Module)result=-1 [000000000000246C: 1.24713 6] ENTER: (wrapper runtime-invoke) object:runtime_invoke_voidthis (object,intptr,intptr,intptr)([System.NullReferenceException:00000000024229E0], 0000000000000000, 0000000000000000, 000000000424C240, ) [000000000000246C: 1.24716 7] ENTER: System.NullReferenceException:.ctor ()(this:00000000024229E0[System.NullReferenceException VintagestoryServer.exe], ) [000000000000246C: 1.24718 8] ENTER: System.SystemException:.ctor (string)(this:00000000024229E0[System.NullReferenceException VintagestoryServer.exe], [STRING:0000000002C301D0:Object reference not set to an instance of an object.], ) [000000000000246C: 1.24720 9] ENTER: System.Exception:.ctor (string)(this:00000000024229E0[System.NullReferenceException VintagestoryServer.exe], [STRING:0000000002C301D0:Object reference not set to an instance of an object.], ) [000000000000246C: 1.24722 10] ENTER: System.Exception:Init ()(this:00000000024229E0[System.NullReferenceException VintagestoryServer.exe], ) [000000000000246C: 1.24723 11] ENTER: (wrapper alloc) object:AllocSmall (intptr,intptr)(000000000044B350, 0000000000000038, ) [000000000000246C: 1.24725 11] LEAVE: (wrapper alloc) object:AllocSmall (intptr,intptr)[System.Runtime.Serialization.SafeSerializationManager:0000000002422AE8] [000000000000246C: 1.24726 10] LEAVE: System.Exception:Init () [000000000000246C: 1.24727 9] LEAVE: System.Exception:.ctor (string) [000000000000246C: 1.24728 9] ENTER: System.Exception:SetErrorCode (int)(this:00000000024229E0[System.NullReferenceException VintagestoryServer.exe], -2146233087, ) [000000000000246C: 1.24730 9] LEAVE: System.Exception:SetErrorCode (int) [000000000000246C: 1.24731 8] LEAVE: System.SystemException:.ctor (string) [000000000000246C: 1.24732 7] LEAVE: System.NullReferenceException:.ctor () [000000000000246C: 1.24733 6] LEAVE: (wrapper runtime-invoke) object:runtime_invoke_voidthis (object,intptr,intptr,intptr)[OBJECT:0000000000000000] [000000000000246C: 1.24736 6] ENTER: (wrapper runtime-invoke) :runtime_invoke_objectthis (object,intptr,intptr,intptr)([System.NullReferenceException:00000000024229E0], 0000000000000000, 000000000019BAC0, 000000000420D270, ) [000000000000246C: 1.24738 7] ENTER: System.Exception:get_Message ()(this:00000000024229E0[System.NullReferenceException VintagestoryServer.exe], ) [000000000000246C: 1.24740 7] LEAVE: System.Exception:get_Message ()[System.String:0000000002422B20] [000000000000246C: 1.24741 6] LEAVE: (wrapper runtime-invoke) :runtime_invoke_objectthis (object,intptr,intptr,intptr)[System.String:0000000002422B20] [000000000000246C:] EXCEPTION handling: System.NullReferenceException: Object reference not set to an instance of an object EXCEPTION: catch found at clause 0 of (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr) [000000000000246C: 1.24747 5] LEAVE: (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)[OBJECT:0000000000000000] [000000000000246C: 1.24789 5] ENTER: (wrapper runtime-invoke) :runtime_invoke_void__this___object_object (object,intptr,intptr,intptr)([System.TypeInitializationException:0000000002422C08], 000000000019D440, 0000000000000000, 000000000424C4B0, ) [000000000000246C: 1.24792 6] ENTER: System.TypeInitializationException:.ctor (string,System.Exception)(this:0000000002422
Looking at the trace, it looks to me like it seems to have problems loading an external libary altogether?
Update: This exception only happens on obfuscation level Maximum, when lowered to Aggressive it loads fine.
Heyho trying to run my obfuscated binaries on mono (windows or linux) gives me this exception:
The unobfuscated version runs fine, and both the obfuscated and nonobfuscated runs fine on windows using the .net framework.
Mono version: 4.4.2 Compiled with target framework: 4.5.2 Confused with ConfuserEx v1.0.0 using default settings (at least for the binary itself)
I could try to reduce the bug to a minimal test case, but I don't know where to start with this odd exception being thrown. Also I could swear it already worked once, but apparently some change made in incompatible. Any ideas how I could trace this?