public void ArrayFieldAssignedInCtor() { var testCode = @" namespace RoslynSandbox { using System; internal class Foo { private IDisposable[] disposables = new IDisposable[1]; internal Foo(IDisposable disposable) { this.disposables[0] = disposable; } } }"; var syntaxTree = CSharpSyntaxTree.ParseText(testCode); var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes()); var semanticModel = compilation.GetSemanticModel(syntaxTree); var ctor = syntaxTree.FindConstructorDeclaration("internal Foo(IDisposable disposable)"); var value = syntaxTree.FindParameter("IDisposable disposable"); var symbol = semanticModel.GetDeclaredSymbol(value, CancellationToken.None); Assert.AreEqual(true, Disposable.IsAssignedToFieldOrProperty(symbol, ctor, semanticModel, CancellationToken.None)); }