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

[Optional, In] parameter shouldn't use in modifier in extern method for managed structs #578

Closed
AArnott opened this issue Jun 5, 2022 · 3 comments · Fixed by #579
Closed
Assignees
Labels
bug Something isn't working

Comments

@AArnott
Copy link
Member

AArnott commented Jun 5, 2022

The MiniDumpWriteDump extern method is emitted with an in modifier for its last parameter. While convenient when specifying the struct value, it makes it syntactically impossible to pass in a null pointer to omit the value.
The metadata describes this last parameter as [Optional, In], so there should be a way to pass in a null pointer.

@AArnott AArnott added the bug Something isn't working label Jun 5, 2022
@AArnott
Copy link
Member Author

AArnott commented Jun 5, 2022

Very peculiarly, the prior two parameters have the same modifiers, and correctly use pointers in the emitted projection.

@AArnott
Copy link
Member Author

AArnott commented Jun 5, 2022

This is because the last parameter's type is managed, since it contains a field that is a delegate type. We could force such parameter types to be unmanaged, or we could force the parameter's type to be an array (of 1) of this struct to allow a null value to be supplied. But the cure may be worse than the disease in either case.

Instead, this should work as a "null" argument, albeit it's undiscoverable: Unsafe.AsRef<MINIDUMP_CALLBACK_INFORMATION>(null).

@AArnott
Copy link
Member Author

AArnott commented Jun 5, 2022

The friendly overload can encapsulate this though.

@AArnott AArnott self-assigned this Jun 5, 2022
@AArnott AArnott changed the title [Optional, In] parameter shouldn't use in modifier in extern method [Optional, In] parameter shouldn't use in modifier in extern method for managed structs Jun 5, 2022
AArnott added a commit that referenced this issue Jun 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant