You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Fact]publicvoidAllowNull_Indexer(){varsource= """
#nullable enable
using System;
using System.Diagnostics.CodeAnalysis;
class C
{
public static void Main()
{
var c = new C();
try
{
_ = c[null]; // no warning
}
catch
{
Console.Write(1);
}
}
public string this[[AllowNull] string s]
{
get
{
return s.ToString(); // expected a warning
}
}
}
""";varverifier= CompileAndVerify([source, AllowNullAttributeDefinition], expectedOutput:"1");
verifier.VerifyDiagnostics();}
Expected Behavior: A warning is reported on the indicated line. A warning would be reported for a similar scenario with an ordinary method.
Actual Behavior: No warning is reported in the sample
The text was updated successfully, but these errors were encountered:
Version Used: fca6e1f
Steps to Reproduce:
Expected Behavior: A warning is reported on the indicated line. A warning would be reported for a similar scenario with an ordinary method.
Actual Behavior: No warning is reported in the sample
The text was updated successfully, but these errors were encountered: