Skip to content

Unable to pin arrays of unmanaged structs #68686

@jkotas

Description

@jkotas

Repro:

using System;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;

[assembly: DisableRuntimeMarshallingAttribute]

object o = new MyStruct[10];
GCHandle h = GCHandle.Alloc(o, GCHandleType.Pinned);

struct MyStruct
{
    char c;
}

Actual result: System.ArgumentException: Object contains non-primitive or non-blittable data.
Expected result: No exceptions

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions