I'm running .NET 9.0.306 on macOS ARM64 and encountering an issue when running unit tests that call an external HTTPS API via HttpClient.
Note - Cookies disabled because problem first appeared as a type init error with CookiesContainer I think.
Minimal reproduction pattern:
HttpClient httpClient =
new(new SocketsHttpHandler()
{
PooledConnectionLifetime = TimeSpan.FromMinutes(1),
UseCookies = false // Disable CookieContainer to avoid macOS .NET 9 ARM64 CSSM initialization bug
});
// Later
response = await httpClient.PostAsJsonAsync(
"https://api.openai.com/v1/chat/completions",
requestDto,
jsonOptions,
cancellationToken);
When I run my tests:
This is logged first.
CSSM_ModuleLoad(): One or more parameters passed to a function were not valid.
Then an exception later:
The SSL connection could not be established, see inner exception.
Happens only on Apple Silicon macOS 15.7.1 - not tested on Windows, works on live Linux in GCP.
Questions:
Why does this happen specifically on macOS ARM64 with .NET 9? Worked under .NET 7, skipped 8.
Is this a known bug in .NET 9?
LLMs reckon this is frictionful area for .NET/OS interop.
InnerExceptionof the second one?bug in .NET 9?more likely a bug of the specific machine, not CPU or OS. You didn't post the full exception text so we can't be sure. SSL issues typically happen because of invalid certificates or incompatible algorithms between client and server. Perhaps the machine is using a blocked certificate, or the server requires an algorithm that isn't available on it. We can't guess. Any inner exceptions will specify what's wrong.problem first appeared as a type init error with CookiesContainer I think.that's not relevant at all. The server refuses to establish the TCP connection in the first place. Cookies are used only once a connection is establishedLLMs reckon this is frictionful area for .NET/OS interopthis is a bug of the LLM or the prompt, and almost completely wrong. If you just google such errors you'll get a lot of SO questions, answers, articles, all of which point to certificate issues or configured algorithms. Sure, the algorithms are provided by the OS, but the actual problem is almost never interop - even if there's a problem with OpenSSL, it's not part of .NET. The LLM should have found that unless something prevented it from using the most probable answer.https://api.openai.com/v1/chat/completionsor an internal URL? In any case, if you click on the padlock and open the certificate info, you'll find the server's certificate settings, algorithms etc.