Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle when DestroyStructure API passes null to the IL marshaller #61985

Merged
merged 1 commit into from
Nov 24, 2021

Conversation

AaronRobinsonMSFT
Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT commented Nov 23, 2021

During the clean up phase for IL marshallers, managed value types passed as nullptr can cause failures.
This is an issue with field marshallers of nested non-blittable types only.

else if (th.HasLayout())
{
MethodDesc* structMarshalStub;
{
GCX_PREEMP();
structMarshalStub = NDirect::CreateStructMarshalILStub(th.GetMethodTable());
}
MarshalStructViaILStub(structMarshalStub, nullptr, ptr, StructMarshalStubs::MarshalOperation::Cleanup);
}

Fixes #61839

/cc @jkoritzinsky @elinor-fung

  managed valuetypes. This is an issue with field marshallers of
  nested non-blittable types.
@AaronRobinsonMSFT
Copy link
Member Author

/backport to release/6.0

@github-actions
Copy link
Contributor

Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1497375119

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NullReferenceException in Marshal.DestroyStructure with embedded structs containing delegates
2 participants