120 references to References
Microsoft.CodeAnalysis (5)
Compilation\Compilation.cs (4)
1611/// required to be from this compilation or some assembly referenced (<see cref="References"/>) by this 1616/// though those references are missing from <see cref="References"/>. 1693foreach (var reference in compilation.References) 1795/// The returned set is a subset of references returned by <see cref="References"/> API.
Compilation\DeterministicKeyBuilder.cs (1)
331compilation.References.AsImmutable(),
Microsoft.CodeAnalysis.CodeStyle (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ICompilationExtensions.cs (1)
27foreach (var reference in compilation.References.OfType<CompilationReference>())
Microsoft.CodeAnalysis.CSharp (2)
Symbols\Compilation_UsedAssemblies.cs (2)
35foreach (var reference in References) 53foreach (var reference in References)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (1)
CodeGen\ForeachTest.cs (1)
798comp = comp.WithReferences(comp.References.Concat(new[] { SystemRuntimeFacadeRef, ValueTupleRef }));
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (4)
Attributes\InternalsVisibleToAndStrongNameTests.cs (4)
2415CompileAndVerify(other.WithReferences(new[] { other.References.ElementAt(0), new CSharpCompilationReference(unsigned) })).VerifyDiagnostics(); 2417CompileAndVerify(other.WithReferences(new[] { other.References.ElementAt(0), MetadataReference.CreateFromStream(unsigned.EmitToStream()) })).VerifyDiagnostics(); 2443var comps = new[] {other.WithReferences(new []{other.References.ElementAt(0), new CSharpCompilationReference(unsigned)}), 2444other.WithReferences(new []{other.References.ElementAt(0), MetadataReference.CreateFromStream(unsigned.EmitToStream()) })};
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (20)
Compilation\CompilationAPITests.cs (10)
363Assert.NotNull(comp.References); 1169foreach (var item in vbComp.References) 1195Assert.True(comp.References.Contains(compRef1)); 1196Assert.True(comp.References.Contains(compRef2)); 1204Assert.True(comp.References.Contains(ref1)); 1209Assert.True(comp.References.Contains(ref2)); 1214Assert.True(comp.References.Contains(compRef2)); 1299foreach (var item in comp.References) 1903Assert.Equal(2, comp.References.Count()); 1904Assert.Equal("alias", comp.References.Last().Properties.Aliases.Single());
Compilation\GetImportScopesTests.cs (1)
403var reference = comp.References.First(r => r.Display!.StartsWith("System.Core"));
Compilation\GetUnusedImportDirectivesTests.cs (1)
145comp = comp.WithReferences(comp.References.Concat(SystemCoreRef));
Compilation\UsedAssembliesTests.cs (5)
107var comp2 = comp.RemoveAllReferences().AddReferences(used.Concat(comp.References.Where(r => r.Properties.Kind == MetadataImageKind.Module))); 283AssertEx.Equal(comp.References.Where(r => r.Properties.Kind == MetadataImageKind.Assembly), comp.GetUsedAssemblyReferences()); 344var comp2 = comp.RemoveAllReferences().AddReferences(used.Concat(comp.References.Where(r => r.Properties.Kind == MetadataImageKind.Module))); 639Assert.True(comp2.References.Count() > 1); 2328Assert.True(comp.References.Count() > 1);
Symbols\CovariantReturnTests.cs (3)
2617var vbComp = CreateVisualBasicCompilation(code: vbSource, referencedAssemblies: csComp.References.Append(csRef)); 4024var lastReference = compilation.GetAssemblyOrModuleSymbol(compilation.References.Last()); 4262var lastReference = compilation.GetAssemblyOrModuleSymbol(compilation.References.Last());
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
CSharpTestBase.cs (2)
1363var resolvedReferences = comp.References.Where(r => r.Properties.Kind == MetadataImageKind.Assembly); 1374var comp2 = comp.RemoveAllReferences().AddReferences(used.Concat(comp.References.Where(r => r.Properties.Kind == MetadataImageKind.Module)));
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
MetadataAsSource\AbstractMetadataAsSourceTests.TestContext.cs (1)
176foreach (var reference in compilation.References)
Microsoft.CodeAnalysis.Rebuild.UnitTests (4)
CompilationRebuildArtifactResolver.cs (1)
23.References
CSharpRebuildTests.cs (2)
40var references = original.References.ToImmutableArray(); 41var rebuild = compilationFactory.CreateCompilation(sources, original.References.ToImmutableArray());
RoundTripUtil.cs (1)
95original.References.ToImmutableArray());
Microsoft.CodeAnalysis.Test.Utilities (2)
Compilation\IRuntimeEnvironment.cs (2)
96foreach (var metadataReference in compilation.References) 185foreach (var reference in compilation.References.OfType<CompilationReference>())
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\UsedAssemblies.vb (1)
28For Each reference In References
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (44)
Compilation\CompilationAPITests.vb (42)
295Assert.NotNull(comp.References) 297Assert.Equal(1, comp.References.Count) 540Assert.Equal(0, comp.References.Count) 547Assert.Equal(1, comp.References.Count) 553Assert.Equal(1, comp.References.Count) 559Assert.Equal(0, comp.References.Count) 564AssertEx.Equal(Of Integer)(0, Enumerable.Count(Of MetadataReference)(compCollection1.References)) 566AssertEx.Equal(Of Integer)(3, Enumerable.Count(Of MetadataReference)(c2.References)) 570AssertEx.Equal(Of Integer)(0, Enumerable.Count(Of MetadataReference)(compCollection2.References)) 572AssertEx.Equal(Of Integer)(3, Enumerable.Count(Of MetadataReference)(c3.References)) 587AssertEx.Equal(Of Integer)(0, Enumerable.Count(Of MetadataReference)(c2.References)) 593Assert.Equal(1, compCollection.References.Count) 595Assert.Equal(0, compCollection.References.Count) 601Assert.Equal(0, compCollection.References.Count) 603Assert.Equal(0, comp.References.Count) 612Assert.Equal(0, compCollection.References.Count) 614Assert.Equal(0, compCollection.References.Count) 623Assert.Equal(0, compCollection.References.Count) 625Assert.Equal(0, compCollection.References.Count) 835Assert.Equal(0, comp.References.Count) 849Assert.Equal(1, comp1.References.Count) 1041For Each item In csComp.References 1045Assert.Equal(1, comp.References.Count) 1063Assert.Equal(2, comp.References.Count) 1065Assert.Contains(compRef1, comp.References) 1066Assert.Contains(compRef2, comp.References) 1073Assert.Equal(3, comp.References.Count) 1074Assert.Contains(ref1, comp.References) 1078Assert.Equal(3, comp.References.Count) 1079Assert.Contains(ref2, comp.References) 1083Assert.Equal(3, comp.References.Count) 1084Assert.Contains(compRef2, comp.References) 1130Assert.Equal(3, comp.References.Count) 1138Assert.Equal(3, comp.References.Count) 1145For Each item In comp.References 1148Assert.Equal(0, comp.References.Count) 1200Assert.Equal(1, comp.References.Count) 1209Assert.Equal(3, comp.References.Count) 1211Assert.Equal(1, comp.References.Count) 1223Assert.Equal(1, comp.References.Count) 1230Assert.Equal(1, comp.References.Count) 1273Assert.Equal(0, comp.References.Count)
SourceGeneration\GeneratorDriverTests_Attributes_FullyQualifiedName.vb (2)
954driver = driver.RunGenerators(compilation.WithReferences(compilation.References.Take(compilation.References.Count() - 1)))
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (7)
SymbolsTests\Retargeting\RetargetingTests.vb (2)
3119For Each r In C.References 3129For Each r In C.References
UsedAssembliesTests.vb (5)
95Dim comp2 = comp.RemoveAllReferences().AddReferences(used.Concat(comp.References.Where(Function(r) r.Properties.Kind = MetadataImageKind.Module))) 134AssertEx.Equal(comp.References.Where(Function(r) r.Properties.Kind = MetadataImageKind.Assembly), comp.GetUsedAssemblyReferences()) 166Dim comp2 = comp.RemoveAllReferences().AddReferences(used.Concat(comp.References.Where(Function(r) r.Properties.Kind = MetadataImageKind.Module))) 461Assert.True(comp2.References.Count() > 1) 2043Assert.True(comp.References.Count() > 1)
Microsoft.CodeAnalysis.Workspaces (7)
FindSymbols\FindReferences\DependentTypeFinder.cs (2)
308foreach (var reference in compilation.References) 328seenPEReferences.AddRange(compilation.References.OfType<PortableExecutableReference>());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ICompilationExtensions.cs (1)
27foreach (var reference in compilation.References.OfType<CompilationReference>())
Workspace\Solution\SolutionCompilationState.ICompilationTracker.cs (2)
25/// If <paramref name="primary"/> is true, then <see cref="Compilation.References"/> will not be considered 31/// any of the references of the <see cref="Compilation.References"/>.
Workspace\Solution\SolutionCompilationState.RootedSymbolSet.cs (2)
58/// cref="Compilation.References"/>. Sorted by the hash code produced by <see 77foreach (var reference in compilation.References)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (6)
VisualStudioMSBuildWorkspaceTests.cs (6)
88var compReferences = compilation.References.ToList(); 231Assert.True(compilation1.References.OfType<CompilationReference>().Any(c => c.Compilation == compilation2) || 232compilation2.References.OfType<CompilationReference>().Any(c => c.Compilation == compilation1)); 322var pref = c2.References.OfType<PortableExecutableReference>().FirstOrDefault(r => r.Display == "CSharpProject"); 349var pref = c2.References.OfType<PortableExecutableReference>().FirstOrDefault(r => r.Display == "EmittedCSharpProject"); 3223Assert.Single(compilation.References.OfType<CompilationReference>());
Microsoft.CodeAnalysis.Workspaces.UnitTests (11)
SolutionTests\SolutionTests.cs (11)
2853Assert.True(compilation.References.Contains(meta), "Compilation references were expected to contain " + meta); 2866compilation.References.Single(r => 5001Assert.True(compilation1.References.Any(r => r is CompilationReference compilationReference && compilationReference.Compilation == compilation2)); 5029Assert.True(compilation2.References.Any(r => r is CompilationReference compilationReference && compilationReference.Compilation == compilation1)); 5126Assert.True(compilation1New.References.Any(r => r is CompilationReference compilationReference && compilationReference.Compilation == compilation2)); 5127Assert.True(compilation1New.References.Any(r => r is CompilationReference compilationReference && compilationReference.Compilation == compilation3)); 5174Assert.True(compilation1.References.Any(r => r is CompilationReference compilationReference && compilationReference.Compilation == compilation2)); 5175Assert.True(compilation1.References.Any(r => r is CompilationReference compilationReference && compilationReference.Compilation == compilation3)); 5190Assert.True(compilation1New.References.All(r => r is not CompilationReference)); 5219Assert.False(compilation1.References.Any(r => r is CompilationReference)); 5698Assert.Single(frozenCompilation2.References.Where(r => r is CompilationReference c && c.Compilation == frozenCompilation1));
Microsoft.VisualStudio.LanguageServices (2)
Library\ObjectBrowser\AbstractListItemFactory.cs (2)
646if (!compilation.References.Any()) 653foreach (var reference in compilation.References)