Skip to content

Track stateful marshallers for each element in unmanaged to managed stubs #89462

Open

Description

@jtschuster

In order to be able to free each element in an array, the generated code should store stateful element marshallers in an array to free them in the AssignOut stage after marshalling.

Activity

  1. ghost added
    untriaged
    on Jul 25, 2023
  2. jkoritzinsky commented on Jul 25, 2023

    @jkoritzinsky
    Member

    We don’t support stateful marshallers for element marshallers, so this is out of scope for now. Marking this as Future

  3. added this to the Future milestone on Jul 25, 2023
  4. removed
    untriaged
    on Jul 25, 2023
  5. jtschuster commented on Jul 25, 2023

    @jtschuster
    MemberAuthor

    We don’t support stateful marshallers for element marshallers

    I don't think we warn for these, I'll make an issue to add a warning

  6. changed the title [-]In order to be able to free each element in an array, the generated code should store stateful element marshallers in an array to free them in the AssignOut stage after marshalling.[/-] [+]Track stateful marshallers for each element in unmanaged to managed stubs[/+] on Jul 25, 2023
  7. jkoritzinsky commented on Jul 25, 2023

    @jkoritzinsky
    Member

    We warn in the analyzer for CustomMarshallerAttribute usage, which isn't referenced in the source generator tests

  8. jwosty commented on Nov 7, 2023

    @jwosty

    Is there an issue tracking stateful marshaling of collection elements? Or is this that issue now?

    I would really like this. Without this, I currently have to resort to manual boilerplate to pass SafeHandle[] and Span<SafeHandle> to native code.

  9. dotnet-policy-service commented on Apr 13, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/interop-contrib
    See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions