.NET: Microsoft Technologies based on the .NET software framework. Runtime: An environment required to run apps that aren't compiled to machine language.
CipherSuitesPolicy is explicitly marked as unsupported on Windows and Android:
[UnsupportedOSPlatform("android")]
[UnsupportedOSPlatform("windows")]
public sealed class CipherSuitesPolicy
This means:
- On Windows,
CipherSuitesPolicyis not supported. The type is annotated as unsupported for all Windows platforms. On such platforms, using APIs that rely on this policy will result inPlatformNotSupportedException. There is no supported scenario on Windows (including Windows Server 2016/2019) where configuring TLS withCipherSuitesPolicyis expected to succeed. - The exception is thrown when the unsupported functionality is actually used.
In the Kestrel case, the failure appears when an HTTPS request arrives and the
OnAuthenticatecallback runs, because that is when the TLS options (includingCipherSuitesPolicy) are applied. If the test environment never receives an HTTPS request, the callback is not invoked and the exception is not triggered, even though the code path is present.
Therefore:
- On Windows, keeping the
CipherSuitesPolicyconfiguration inhttpsOptions.OnAuthenticateis not valid and will causePlatformNotSupportedExceptiononce the callback executes. - Removing or conditionally excluding this configuration on Windows is the correct and necessary fix to avoid runtime crashes.
References: