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
[Desktop] System.AccessViolationException on HttpClient with Certificates #25240
Comments
Can you repro this problem with .NET Core? If this only happens on .NET Framework, we should move this issue to that bug database. cc: @karelz @stephentoub |
Sorry, my employee won't give me the time to reproduce this with .Net Core. |
Since this code use var clientHandler = new WebRequestHandler(); |
Ok, thx. Where shall I report it? |
@karelz pls advise on best way to report .NET Framework bugs. @StefanoD, I do have a comment about your current snippet of repro code: private static byte[] GetClientCertificate()
{
var res = new ResourceManager("QLCClient.resources", typeof(QlcTestResultsController).Assembly);
byte[] rawCert = (byte[]) res.GetObject("my_cert");
return rawCert;
} It is not clear from this code whether or not the client certificate is good. Where did those bytes[] come from? Normally a client certificate needs to be trusted and have the private key accessible. And that usually happens only when retrieving a client certificate from a certificate store. Is this certificate something that is in PFX format, for example? So, it's possible that the My guess is that this is not a bug in .NET Framework, but rather an improper way of storing and using client certificates. |
@davidsh The client certificate has been created by me and is normally not trusted. But this is not a problem, because my peer does a custom validation (by checking the fingerprint). As I said before: The How should I store my certificate? I want it to be embedded. |
Have you been able to repro the Is it possible for you to create a complete Visual Studio solution of the repro and attach it here as a zip file? That would allow us to troubleshoot this directly. |
Looks like we don't have enough information / repro to make it actionable. Closing. |
Hi,
I think, this bug relates to #20628, respective to #20117.
When I'm using mutual authentification per SSL and I send something to a server, then I get a
System.AccessViolationException
without any stack trace.Here is my custom class which extends
HttpClient
and uses a client certificate and has a custom certificate validation:When I step with Visual Studio line by line, then I get the named Exception on
SendAsync()
.I'm using .Net Framework 4.6.2 and I get this Exception only in my system test. But when I migrate to .Net Framework 4.7.1 then I get this also in production code. So I think the bug is always there and it depends on the runtime behaviour.
The text was updated successfully, but these errors were encountered: