-
Notifications
You must be signed in to change notification settings - Fork 5k
SafeCertContextHandle is missing a default constructor #43016
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
Comments
Tagging subscribers to this area: @bartonjs, @vcsjones, @krwq, @jeffhandley |
Interesting. I'll take a look. |
Here's what I found.
|
"Can we consolidate them and clean this up? 🤔" Yeah I think that work is being tracked in #26541. It's a bit tangled up though, I'll see if I can keep chipping away at that cleanup effort. |
I don't have a vested interest in the resolution of this - if this is essentially a dup of #26541, we can close this. I hit this when running a tool that eagerly pregenerates p/invoke interop and this hit a bug in the tool where it didn't handle junk input well. I fixed the bug in the tool and filed this because I was already in the middle of yak shaving and didn't want to deal with another yak. |
Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process. This process is part of our issue cleanup automation. |
This issue will now be closed since it had been marked |
This one:
runtime/src/libraries/System.Security.Cryptography.Pkcs/src/Microsoft/Win32/SafeHandles/SafeCertContextHandle.cs
Line 12 in 6072e4d
Without that, it cannot be used in return value marshalling because the return value marshaller needs the default constructor to make an instance of one.
Here's an example of a p/invoke that doesn't actually work because of this:
runtime/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertCreateCertificateContext.cs
Lines 11 to 16 in 6072e4d
Interop.CertCreateCertificateContext.cs is probably dead code. But I can see that
SafeCertContextHandle
is actually used as a return value in a number of p/invokes. It should probably be investigated why they're not failing (or why we have no coverage).Here's a sample standalone example showing the CertCreateCertificateContext p/invoke not actually working (feel free to paste into an empty console app):
The above example will fail with a useless
System.MissingMethodException: '.ctor'
, but that's what interop is complaining about.The text was updated successfully, but these errors were encountered: