Version Used:
Microsoft.CodeAnalysis.Analyzers 3.3.2
Microsoft.CodeAnalysis.CSharp.Workspaces 3.9.0
Steps to Reproduce:
- Use Roslyn to obtain an
IOperation for the Test method in the following code block:
using System.Linq;
public class Subject
{
public static int Test()
{
return Enumerable.Range(0, 3).Sum(LocalFunction);
int LocalFunction(int x)
{
return x + 1;
}
}
}
- Drill down to find the
IMethodReferenceOperation for the reference to LocalFunction.
Expected Behavior:
The IMethodReferenceOperation's Instance property is null, because the Test method is static.
Actual Behavior:
The Instance property is an IInstanceReferenceOperation of kind ContainingTypeInstance.
Version Used:
Microsoft.CodeAnalysis.Analyzers 3.3.2
Microsoft.CodeAnalysis.CSharp.Workspaces 3.9.0
Steps to Reproduce:
IOperationfor theTestmethod in the following code block:IMethodReferenceOperationfor the reference toLocalFunction.Expected Behavior:
The
IMethodReferenceOperation'sInstanceproperty is null, because theTestmethod is static.Actual Behavior:
The
Instanceproperty is anIInstanceReferenceOperationof kindContainingTypeInstance.