Open
Description
Android application type
.NET Android (net7.0-android, net8.0-android, etc.)
Affected platform version
VS2022 18.3 with .net 34.0.43/8.0.100
Description
When you using AndroidMessageHandler with ServerCertificateCustomValidationCallback that returns false while debugging you may get application crash.
Steps to Reproduce
- Create new android app with code like this
Sample code:
try
{
using (var ch = new AndroidMessageHandler())
{
ch.ServerCertificateCustomValidationCallback += (a, b, c, d) => false;
using (var hc = new HttpClient(ch))
{
var result = await hc.GetAsync("https://github.com");
// never get here
}
}
}
catch (Exception ex)
{
// may be get here
XDebug.WriteLine($"exception handled {ex.Message}");
}
- Run it several times. Two times in my case.
- Observe application crash.
See sample project in attachment: UnhandledCertificateException.zip
Did you find any workaround?
No response
Relevant log output
No response