Description
Description
Based on the documentation of the delegate "LocalCertificateSelectionCallback", the return value can be null. However, the delegate is declared to return a notnull X509Certificate.
Link to the documentation:
https://learn.microsoft.com/en-us/dotnet/api/system.net.security.localcertificateselectioncallback?view=net-8.0
Reproduction Steps
Create a project with nullable warning enabled that implements the sample code defined in the documentation of delegate LocalCertificateSelectionCallback.
Compile the project and you will get a nullable warning with return value of SelectLocalCertificate.
If you declare the SelectLocalCertificate to return "X509Certificate?" instead of "X509Certificate", you get a warning when instantiating SslStream object.
Expected behavior
The declaration of LocalCertificateSelectionCallback delegate shall indicates that return value can be null.
Documentation of the delegate is updated.
Actual behavior
The declaration of LocalCertificateSelectionCallback delegate indicates that method return a non-null value.
The sample code return a null value. The impact that we get a nullable warning when we implements this delegate.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response