Can't invoke method correctly
MinorPunk opened this issue · comments
I want to serialize an C# Object, here's some of my codes.
const BinaryFormatter = Il2Cpp.corlib.class("System.Runtime.Serialization.Formatters.Binary.BinaryFormatter");
const MemoryStream = Il2Cpp.corlib.class("System.IO.MemoryStream");
Il2Cpp.gc.choose(someClass).forEach((instance: Il2Cpp.Object) => {
const asset = ReturnedFromSomeMethod as Il2Cpp.Object;
const bf = BinaryFormatter.new();
bf.method('.ctor').invoke();
const ms = MemoryStream.new();
ms.method('.ctor').invoke();
console.log(bf.method("Serialize"));
console.log(ms);
console.log(asset.handle);
bf.method<void>("Serialize").invoke(ms, asset);
});
And here is the output
System.Void Serialize(System.IO.Stream serializationStream, System.Object graph); // 0x025dc958
System.IO.MemoryStream
0x6e5984b2a0
Error: abort was called
at invokeRaw (il2cpp/structs/method.ts:233)
at <anonymous> (index.ts:89)
at forEach (native)
at <anonymous> (index.ts:96)
at perform (il2cpp/perform.ts:15)
I have no ideas how to solve this, tried everything I can.
Thanks for any help.
frida-il2cpp-bridge version: 0.9.0
frida version: 16.2.1
Unity version: 2021.3.17f1