-
Notifications
You must be signed in to change notification settings - Fork 206
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
Passing null for array of blittable types results in NullReferenceException #1051
Comments
|
We can't just do |
@jkoritzinsky I recall this being an issue we wanted to fix but given the compat burden we decided not to do that. We should have a conversation around the GDI+ API surface and see if it is something we want to support. I'm not convinced a single API surface should force this decision. |
These bogus null pointer checks are not unusual in the Windows APIs. For example here: https://github.com/dotnet/runtime/blob/01b7e73cd378145264a7cb7a09365b41ed42b240/src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.Icu.cs#L733 or here https://github.com/dotnet/runtime/pull/52030/files#diff-4b9bcd238c75b08d184c630e8e90372464f848bbb2ed0466c0c3bafe74ee27b7R23 The eventual marshaling of Spans will hit similar problem. |
Fixed by #1063 |
Generated code doesn't handle
null
when marshalling an array of blittable types.In the generated code, we pass null to
MemoryMarshal.GetArrayDataReference
throwsNullReferenceException
:cc @AaronRobinsonMSFT @jkoritzinsky
The text was updated successfully, but these errors were encountered: