Skip to content

Method not found: 'Void System.__Canon..ctor(IntPtr) #73

@dommrogers

Description

@dommrogers

MelonLoader v0.6.0 ALPHA Pre-Release
Game Name: TheLongDark
Unity Version: 2021.3.6f1
Game Version: 2.06
Using Il2CppInterop Version = 1.4.3-ci.244

The following exception occurs when trying to either

string text = "";
Il2CppTLD.Serialization.SerializationUtils.TryDeserializeObject<string>("some test text here", out text);
-----------------------------------------------
string text = "";
SaveGameSlots.TryLoadDataFromSlot<string>(SaveSlotName,"KeyToGet", out text);
System.MissingMethodException: Method not found: 'Void System.__Canon..ctor(IntPtr)'.
   at Il2CppTLD.Serialization.SerializationUtils.TryDeserializeObject[T](String text, T& result)

It was suggested to me that it's a potential problem with new T(intPtr2) in

[CallerCount(6)]
        [CachedScanResults(RefRangeStart = 1397578, RefRangeEnd = 1397584, XrefRangeStart = 1397567, XrefRangeEnd = 1397578, MetadataInitTokenRva = 0L, MetadataInitFlagRva = 0L)]
        public unsafe static bool TryDeserializeObject<T>(string text, out T result)
        {
            System.IntPtr* ptr = stackalloc System.IntPtr[2];
            *ptr = IL2CPP.ManagedStringToIl2Cpp(text);
            byte* num = (byte*)ptr + checked((nuint)1u * unchecked((nuint)sizeof(System.IntPtr)));
            System.IntPtr intPtr = IL2CPP.Il2CppObjectBaseToPtr(System.Runtime.CompilerServices.Unsafe.As<T, Il2CppObjectBase>(ref result));
            *(System.IntPtr**)num = &intPtr;
            System.IntPtr exc;
            System.IntPtr obj = IL2CPP.il2cpp_runtime_invoke(MethodInfoStoreGeneric_TryDeserializeObject_Public_Static_Boolean_String_byref_T_0<T>.Pointer, (System.IntPtr)0, (void**)ptr, ref exc);
            Il2CppException.RaiseExceptionIfNecessary(exc);
            System.IntPtr intPtr2 = intPtr;
            System.Runtime.CompilerServices.Unsafe.As<T, object>(ref result) = ((intPtr2 == (System.IntPtr)0) ? ((T)null) : new T(intPtr2));
            return *(bool*)IL2CPP.il2cpp_object_unbox(obj);
        }

"System.__Canon is an implementation detail related to the way generics are implemented in the CLR"
https://stackoverflow.com/questions/16854393/strange-system-canon-exception

Please let me know if i can provide any other information or test anything,
Dom (STBlade)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions