Skip to content

Delegate has parameter of type X (non-blittable struct) which is not supported #265

@TrustNoOneElse

Description

@TrustNoOneElse

This error message is coming when we try to use a ValueType in a Delegate from https://github.com/BepInEx/Il2CppInterop/blob/master/Il2CppInterop.Runtime/DelegateSupport.cs#L234

I wanted to ask if its possible to support that and if so whats the blocker?
Because i checked it out a bit and it seems there is already something in the repo regarding this:

  • Il2CppInterop.Runtime/Injection/ClassInjector.cs
  • Il2CppInterop.HarmonySupport/Il2CppDetourMethodPatcher.cs
    Those paths already contain logic to deal with Il2CppSystem.ValueType wrappers by:
  • boxing native value data with IL2CPP.il2cpp_value_box
  • constructing the managed wrapper from the boxed pointer
  • handling struct return buffers for large returns
  • copying unboxed data back to native memory

I would also be glad to help on this topic, if its wished! :)

Thanks for reading.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions