-
Notifications
You must be signed in to change notification settings - Fork 240
Open
Labels
BugExceptions and blocking issues during analysis.Exceptions and blocking issues during analysis.
Description
Description
When getting the certificate validation callback from a static method of a static class in a separate file which in turn calls another static method, the CertificateValidationCheck analyzer crashes with a System.ArgumentException: Syntax node is not within syntax tree (presumably because it can't find the method).
Workaround: Putting the validation class in the same file as it is used in, no error occurs.
Reproducer
Program.cs:
using var test = new SslStream(new MemoryStream(), false, CertValidator.GetCallback());CertValidator.cs:
public static class CertValidator
{
public static RemoteCertificateValidationCallback? GetCallback()
{
return (s, cert, chain, errors) =>
{
return Validate(errors);
};
}
private static bool Validate(SslPolicyErrors errors)
{
return errors == SslPolicyErrors.None;
}
}Product and Version
NuGet SonarAnalyzer.CSharp 10.20.0.135146
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugExceptions and blocking issues during analysis.Exceptions and blocking issues during analysis.