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

Enable P/Invoke for unmanaged pointers to non-blittable types #13772

Closed
tannergooding opened this issue Nov 10, 2019 · 1 comment
Closed

Enable P/Invoke for unmanaged pointers to non-blittable types #13772

tannergooding opened this issue Nov 10, 2019 · 1 comment

Comments

@tannergooding
Copy link
Member

As per dotnet/coreclr#23899 (comment), we could enable unmanaged pointers to non-blittable types (such as bool) by removing the existing restriction found in srv/vm/mlinfo.cpp

@tannergooding tannergooding self-assigned this Nov 10, 2019
@tannergooding
Copy link
Member Author

cc. @jkoritzinsky

jkoritzinsky referenced this issue in jkoritzinsky/runtime Jan 17, 2020
Don't block non-blittable pointer types in P/Invokes. If you're using pointers in interop you're already using unsafe code so we're going to assume you know what you're doing. C# won't let you form a pointer to a reference, so there's no risk of passing an object reference directly to native unless you're writing IL directly.

Fixes dotnet/coreclr#27800
jkoritzinsky referenced this issue Jan 23, 2020
* Don't block non-blittable pointer types in P/Invokes.

Don't block non-blittable pointer types in P/Invokes. If you're using pointers in interop you're already using unsafe code so we're going to assume you know what you're doing. C# won't let you form a pointer to a reference, so there's no risk of passing an object reference directly to native unless you're writing IL directly.

Fixes dotnet/coreclr#27800

* Delete unused resources.

* Apply fix to managed type system as well.

* Add positive test for nonblittable pointers. Remove negative tests that were in GenericTest.
@msftgits msftgits transferred this issue from dotnet/coreclr Jan 31, 2020
@msftgits msftgits added this to the 5.0 milestone Jan 31, 2020
@tannergooding tannergooding removed their assignment May 26, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants