Branch master (21 Jun 2019)
Latest commit 898bed by Heejae Chang:
added NFW to get some data on incremental parsing bug where source si� (#36620)
* added NFW to get some data on incremental parsing bug where source size and tree size is different
* more comments
Steps to Reproduce:
Compile the following code:
#nullable enable
using System.Diagnostics.CodeAnalysis;
public class C
{
public void M1(C? c)
{
var (x, y) = c;
c.ToString();
}
public void M2(C? c)
{
Ext.Deconstruct(c, out int x, out int y);
c.ToString();
}
}
static class Ext
{
public static extern void Deconstruct([NotNull] this C? c, out int x, out int y);
}
namespace System.Diagnostics.CodeAnalysis
{
public sealed class NotNullAttribute : Attribute
{
}
}
Expected Behavior:
Both methods have the same set of warnings because they are equivalent.
Actual Behavior:
The first method has a warning CS8602: Dereference of a possibly null reference. for c.ToString(). The second method doesn't.
It looks like Roslyn does not learn from the [NotNull] annotation when deconstruct method is called implicitly.
Version Used:
Steps to Reproduce:
Compile the following code:
Expected Behavior: Both methods have the same set of warnings because they are equivalent.
Actual Behavior: The first method has a warning
CS8602: Dereference of a possibly null reference.
forc.ToString()
. The second method doesn't.It looks like Roslyn does not learn from the
[NotNull]
annotation when deconstruct method is called implicitly.