0

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.

7
  • And what is the InnerException of the second one? Commented Oct 22 at 15:08
  • 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. Commented Oct 23 at 12:36
  • 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 established Commented Oct 23 at 12:37
  • As for LLMs reckon this is frictionful area for .NET/OS interop this 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. Commented Oct 23 at 12:41
  • What happens when you open that URL in your browser? Does it work or not? Is it truly https://api.openai.com/v1/chat/completions or 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. Commented Oct 23 at 12:42

1 Answer 1

0

It is immediately working today. I noticed "Auto-run in Sandbox" in Cursor had appeared recently.

Sandbox is currently available on macOS only. Linux support is coming soon. Windows users can use WSL or devcontainers for sandboxed command execution.

By default, Agent runs terminal commands in a restricted environment that blocks unauthorized file access and network activity

It seems, as often happens, two changes (one obvious and large, and the other silent and unnoticed) coincide to cause grief.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.