1

I am using Frida il2cppbridge and having the problem that I'm getting always access violation error when trying to add values to generic list. What I'm doing wrong?

let list = Il2Cpp.corlib.class("System.Collections.Generic.List`1")
let int = Il2Cpp.corlib.class("System.Int32")
let listInt = list.inflate(int).new()
                     
listInt.method(".ctor").invoke()
listInt.method("Add").invoke(1)

or also if I get the list from internal like:

// return type is List<int>
let list = anyClass.method<Il2Cpp.Object>("getList").invoke()
                     

list.method("Add").invoke(1)

Getting always the same error, doesn't matter if I try method Add, Insert or set_Item

Error:

access violation accessing 0x3e8
at invokeRaw (il2cpp/structs/method.ts:233)
at (src/index.ts:18)
at call (native)
at (il2cpp/structs/method.ts:354)

Methods like get_Count works fine.

2
  • One possibility is that you supply the constant 1 as argument and not an System.Int32. Normally wrapping of primitive types is often performed automatically by the compiler - but on Frida/il2cppbridge there is no compiler, so you have to do these operations on your own. Commented Mar 1, 2024 at 14:24
  • I think you're right but if I create a System.Int32 variable and then use TryParse for example to set it, inside the Add method I get the message that I'm using wrong type and that I need type number or any other il2cpp type. Commented Mar 1, 2024 at 14:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.