3 types derived from MetadataReference
Microsoft.CodeAnalysis (3)
MetadataReference\CompilationReference.cs (1)
16public abstract class CompilationReference : MetadataReference, IEquatable<CompilationReference>
MetadataReference\PortableExecutableReference.cs (1)
16public abstract class PortableExecutableReference : MetadataReference
MetadataReference\UnresolvedMetadataReference.cs (1)
13public sealed class UnresolvedMetadataReference : MetadataReference
4407 references to MetadataReference
BuildValidator (4)
LocalReferenceResolver.cs (2)
117public bool TryResolveReferences(MetadataReferenceInfo metadataReferenceInfo, [NotNullWhen(true)] out MetadataReference? metadataReference) 134metadataReference = MetadataReference.CreateFromStream(
RebuildArtifactResolver.cs (2)
30public MetadataReference ResolveMetadataReference(MetadataReferenceInfo metadataReferenceInfo) 32if (!ReferenceResolver.TryResolveReferences(metadataReferenceInfo, out var metadataReference))
ConfigurationSchemaGenerator (1)
ConfigSchemaGenerator.cs (1)
50return MetadataReference.CreateFromFile(path, documentation: documentationProvider);
ConfigurationSchemaGenerator.Tests (30)
GeneratorTests.cs (30)
44private static readonly ImmutableArray<MetadataReference> s_defaultReferences = 46MetadataReference.CreateFromFile(typeof(Attribute).Assembly.Location), 47MetadataReference.CreateFromFile(typeof(Attribute).Assembly.Location.Replace("System.Private.CoreLib", "System.Runtime")), 48MetadataReference.CreateFromFile(typeof(Enumerable).Assembly.Location), 49MetadataReference.CreateFromFile(typeof(HttpContent).Assembly.Location) 453ImmutableArray<MetadataReference> references = [ 454MetadataReference.CreateFromFile(typeof(Uri).Assembly.Location), 455MetadataReference.CreateFromFile(typeof(X509Certificate2).Assembly.Location) 684ImmutableArray<MetadataReference> references = [ 685MetadataReference.CreateFromFile(typeof(TypeConverter).Assembly.Location), 686MetadataReference.CreateFromFile(typeof(TypeConverterAttribute).Assembly.Location), 687MetadataReference.CreateFromFile(typeof(Host).Assembly.Location), 688MetadataReference.CreateFromFile(typeof(IHost).Assembly.Location), 689MetadataReference.CreateFromFile(typeof(IServiceCollection).Assembly.Location), 690MetadataReference.CreateFromFile(typeof(IServiceProvider).Assembly.Location), 691MetadataReference.CreateFromFile(typeof(IConfigurationBuilder).Assembly.Location), 692MetadataReference.CreateFromFile(typeof(ConfigurationManager).Assembly.Location), 693MetadataReference.CreateFromFile(typeof(IOptionsMonitor<>).Assembly.Location), 694MetadataReference.CreateFromFile(typeof(OptionsBuilderConfigurationExtensions).Assembly.Location), 695MetadataReference.CreateFromFile(typeof(BinderOptions).Assembly.Location), 696MetadataReference.CreateFromFile(typeof(Console).Assembly.Location) 754ImmutableArray<MetadataReference> references = [ 755MetadataReference.CreateFromFile(typeof(DynamicAttribute).Assembly.Location), 756MetadataReference.CreateFromFile(typeof(JsonNamingPolicy).Assembly.Location) 782ImmutableArray<MetadataReference> references = 784MetadataReference.CreateFromFile(typeof(ConfigurationKeyNameAttribute).Assembly.Location) 822ImmutableArray<MetadataReference> references = 824MetadataReference.CreateFromFile(typeof(ConfigurationKeyNameAttribute).Assembly.Location) 1356ImmutableArray<MetadataReference> references = [ 1559private static string GenerateSchemaFromCode(string sourceText, IEnumerable<MetadataReference> references)
IdeCoreBenchmarks (1)
SwitchStatementBenchmarks.cs (1)
71solution = solution.AddMetadataReference(projectId, MetadataReference.CreateFromFile(typeof(object).Assembly.Location));
InteractiveHost.UnitTests (4)
AbstractInteractiveHostTests.cs (1)
194TempDirectory dir, string fileName, string assemblyName, string source, params MetadataReference[] references)
InteractiveHostDesktopTests.cs (3)
439MetadataReference.CreateFromImage(dll.Image)); 467MetadataReference.CreateFromImage(TestResources.General.C2.AsImmutableOrNull())); 485MetadataReference.CreateFromFile(lib1.Path));
Microsoft.Analyzers.Extra.Tests (9)
Resources\RoslynTestUtils.cs (5)
38var refs = new List<MetadataReference>(); 41refs.Add(MetadataReference.CreateFromFile(corelib)); 42refs.Add(MetadataReference.CreateFromFile(Path.Combine(runtimeDir, "netstandard.dll"))); 43refs.Add(MetadataReference.CreateFromFile(Path.Combine(runtimeDir, "System.Runtime.dll"))); 50refs.Add(MetadataReference.CreateFromFile(r.Location));
SyntaxNodeExtensionsTests.cs (4)
52references: new[] { MetadataReference.CreateFromFile(typeof(object).Assembly.Location) }); 84references: new[] { MetadataReference.CreateFromFile(typeof(object).Assembly.Location) }); 147references: new[] { MetadataReference.CreateFromFile(typeof(object).Assembly.Location) }); 177references: new[] { MetadataReference.CreateFromFile(typeof(object).Assembly.Location) });
Microsoft.Analyzers.Local.Tests (5)
Resources\RoslynTestUtils.cs (5)
38var refs = new List<MetadataReference>(); 41refs.Add(MetadataReference.CreateFromFile(corelib)); 42refs.Add(MetadataReference.CreateFromFile(Path.Combine(runtimeDir, "netstandard.dll"))); 43refs.Add(MetadataReference.CreateFromFile(Path.Combine(runtimeDir, "System.Runtime.dll"))); 50refs.Add(MetadataReference.CreateFromFile(r.Location));
Microsoft.AspNetCore.Analyzer.Testing (2)
DiagnosticProject.cs (1)
49solution = solution.AddMetadataReference(projectId, MetadataReference.CreateFromFile(resolveReferencePath));
DiagnosticVerifier.cs (1)
169Solution = Solution.AddMetadataReference(projectId, MetadataReference.CreateFromFile(resolveReferencePath));
Microsoft.AspNetCore.Analyzers.Test (5)
src\Shared\AnalyzerTesting\TestReferences.cs (4)
16public static ImmutableArray<MetadataReference> MetadataReferences { get; } = GetMetadataReferences(); 18private static ImmutableArray<MetadataReference> GetMetadataReferences() 22var references = ImmutableArray.CreateBuilder<MetadataReference>(); 56references.Add(MetadataReference.CreateFromFile(assemblyPath));
StartupCSharpAnalyzerTest.cs (1)
14public StartupCSharpAnalyzerTest(StartupAnalyzer analyzer, ImmutableArray<MetadataReference> metadataReferences)
Microsoft.AspNetCore.App.Analyzers.Test (3)
Infrastructure\WellKnownTypesTests.cs (2)
65project = project.AddMetadataReference(MetadataReference.CreateFromStream(assemblyStream)); 72private static Stream GetInMemoryAssemblyStreamForCode(string code, string assemblyName, params MetadataReference[] references)
TestDiagnosticAnalyzer.cs (1)
159project = project.AddMetadataReference(MetadataReference.CreateFromFile(assembly));
Microsoft.AspNetCore.Components.Analyzers.Tests (8)
Helpers\DiagnosticVerifier.Helper.cs (8)
20private static readonly MetadataReference CorlibReference = MetadataReference.CreateFromFile(typeof(object).Assembly.Location); 21private static readonly MetadataReference SystemCoreReference = MetadataReference.CreateFromFile(typeof(Enumerable).Assembly.Location); 22private static readonly MetadataReference CSharpSymbolsReference = MetadataReference.CreateFromFile(typeof(CSharpCompilation).Assembly.Location); 23private static readonly MetadataReference CodeAnalysisReference = MetadataReference.CreateFromFile(typeof(Compilation).Assembly.Location);
Microsoft.AspNetCore.Components.SdkAnalyzers.Tests (8)
Helpers\DiagnosticVerifier.Helper.cs (8)
20private static readonly MetadataReference CorlibReference = MetadataReference.CreateFromFile(typeof(object).Assembly.Location); 21private static readonly MetadataReference SystemCoreReference = MetadataReference.CreateFromFile(typeof(Enumerable).Assembly.Location); 22private static readonly MetadataReference CSharpSymbolsReference = MetadataReference.CreateFromFile(typeof(CSharpCompilation).Assembly.Location); 23private static readonly MetadataReference CodeAnalysisReference = MetadataReference.CreateFromFile(typeof(Compilation).Assembly.Location);
Microsoft.AspNetCore.Http.Extensions.Tests (1)
RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (1)
340project = project.AddMetadataReference(MetadataReference.CreateFromFile(resolveReferencePath));
Microsoft.AspNetCore.Http.Microbenchmarks (1)
src\Http\Http.Extensions\test\RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (1)
340project = project.AddMetadataReference(MetadataReference.CreateFromFile(resolveReferencePath));
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (5)
LazyMetadataReferenceFeature.cs (1)
23public IReadOnlyList<MetadataReference> References => _referenceManager.CompilationReferences;
RazorReferenceManager.cs (4)
20private IReadOnlyList<MetadataReference>? _compilationReferences; 30public virtual IReadOnlyList<MetadataReference> CompilationReferences 42private IReadOnlyList<MetadataReference> GetCompilationReferences() 73private static MetadataReference CreateMetadataReference(string path)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (2)
TestInfrastructure\TestRazorReferenceManager.cs (2)
17CompilationReferences = Array.Empty<MetadataReference>(); 20public override IReadOnlyList<MetadataReference> CompilationReferences { get; }
Microsoft.CodeAnalysis (177)
CommandLine\CommandLineArguments.cs (4)
371public IEnumerable<MetadataReference> ResolveMetadataReferences(MetadataReferenceResolver metadataResolver) 390internal IEnumerable<MetadataReference> ResolveMetadataReferences(MetadataReferenceResolver metadataResolver, List<DiagnosticInfo>? diagnosticsOpt, CommonMessageProvider? messageProviderOpt) 394var resolved = new List<MetadataReference>(); 400internal virtual bool ResolveMetadataReferences(MetadataReferenceResolver metadataResolver, List<DiagnosticInfo>? diagnosticsOpt, CommonMessageProvider? messageProviderOpt, List<MetadataReference> resolved)
CommandLine\CommonCompiler.cs (4)
214return MetadataReference.CreateFromFile(peStream, path, PEStreamOptions.PrefetchEntireImage, properties, documentation: null); 227internal List<MetadataReference> ResolveMetadataReferences( 234List<MetadataReference> resolved = new List<MetadataReference>();
CommandLine\CommonCompiler.ExistingReferencesResolver.cs (3)
25private readonly ImmutableArray<MetadataReference> _availableReferences; 28public ExistingReferencesResolver(MetadataReferenceResolver resolver, ImmutableArray<MetadataReference> availableReferences) 50private static AssemblyIdentity? TryGetIdentity(MetadataReference metadataReference)
Compilation\Compilation.cs (33)
78ImmutableArray<MetadataReference> references, 197ImmutableArray<MetadataReference> references, 668internal static ImmutableArray<MetadataReference> ValidateReferences<T>(IEnumerable<MetadataReference>? references) 674var reference = result[i]; 702public ImmutableArray<MetadataReference> ExternalReferences { get; } 707public abstract ImmutableArray<MetadataReference> DirectiveReferences { get; } 717internal abstract IDictionary<(string path, string content), MetadataReference> ReferenceDirectiveMap { get; } 723public IEnumerable<MetadataReference> References 727foreach (var reference in ExternalReferences) 732foreach (var reference in DirectiveReferences) 758public Compilation WithReferences(IEnumerable<MetadataReference> newReferences) 768public Compilation WithReferences(params MetadataReference[] newReferences) 770return this.WithReferences((IEnumerable<MetadataReference>)newReferences); 776protected abstract Compilation CommonWithReferences(IEnumerable<MetadataReference> newReferences); 783public Compilation AddReferences(params MetadataReference[] references) 785return AddReferences((IEnumerable<MetadataReference>)references); 793public Compilation AddReferences(IEnumerable<MetadataReference> references) 813public Compilation RemoveReferences(params MetadataReference[] references) 815return RemoveReferences((IEnumerable<MetadataReference>)references); 823public Compilation RemoveReferences(IEnumerable<MetadataReference> references) 835var refSet = new HashSet<MetadataReference>(this.ExternalReferences); 840foreach (var r in references.Distinct()) 857return CommonWithReferences(SpecializedCollections.EmptyEnumerable<MetadataReference>()); 867public Compilation ReplaceReference(MetadataReference oldReference, MetadataReference? newReference) 890public ISymbol? GetAssemblyOrModuleSymbol(MetadataReference reference) 895protected abstract ISymbol? CommonGetAssemblyOrModuleSymbol(MetadataReference reference); 901/// Gets the <see cref="MetadataReference"/> that corresponds to the assembly symbol. 904public MetadataReference? GetMetadataReference(IAssemblySymbol assemblySymbol) 909private protected abstract MetadataReference? CommonGetMetadataReference(IAssemblySymbol assemblySymbol); 1693foreach (var reference in compilation.References) 1812public abstract ImmutableArray<MetadataReference> GetUsedAssemblyReferences(CancellationToken cancellationToken = default(CancellationToken));
Compilation\DeterministicKey.cs (2)
53ImmutableArray<MetadataReference> references, 80ImmutableArray<MetadataReference> references,
Compilation\DeterministicKeyBuilder.cs (4)
123ImmutableArray<MetadataReference> references, 201ImmutableArray<MetadataReference> references, 225foreach (var reference in references) 286MetadataReference reference,
Diagnostic\CommonMessageProvider.cs (4)
210public abstract void ReportDuplicateMetadataReferenceStrong(DiagnosticBag diagnostics, Location location, MetadataReference reference, AssemblyIdentity identity, MetadataReference equivalentReference, AssemblyIdentity equivalentIdentity); 211public abstract void ReportDuplicateMetadataReferenceWeak(DiagnosticBag diagnostics, Location location, MetadataReference reference, AssemblyIdentity identity, MetadataReference equivalentReference, AssemblyIdentity equivalentIdentity);
MetadataReference\CompilationReference.cs (1)
97internal sealed override MetadataReference WithPropertiesImplReturningMetadataReference(MetadataReferenceProperties properties)
MetadataReference\MetadataReference.cs (7)
50public MetadataReference WithAliases(IEnumerable<string> aliases) 60public MetadataReference WithEmbedInteropTypes(bool value) 70public MetadataReference WithAliases(ImmutableArray<string> aliases) 80public MetadataReference WithProperties(MetadataReferenceProperties properties) 90internal abstract MetadataReference WithPropertiesImplReturningMetadataReference(MetadataReferenceProperties properties); 299public static MetadataReference CreateFromAssembly(Assembly assembly) 327public static MetadataReference CreateFromAssembly(
MetadataReference\MetadataReferenceResolver.cs (2)
20/// True to instruct the compiler to invoke <see cref="ResolveMissingAssembly(MetadataReference, AssemblyIdentity)"/> for each assembly reference that 31public virtual PortableExecutableReference? ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity) => null;
MetadataReference\PortableExecutableReference.cs (3)
119internal sealed override MetadataReference WithPropertiesImplReturningMetadataReference(MetadataReferenceProperties properties) 151/// other than <see cref="Compilation.WithReferences(MetadataReference[])"/> overloads. A compilation created using 152/// <see cref="Compilation.WithReferences(MetadataReference[])"/> will call to <see cref="GetMetadataNoCopy"/> again.
MetadataReference\UnresolvedMetadataReference.cs (1)
36internal override MetadataReference WithPropertiesImplReturningMetadataReference(MetadataReferenceProperties properties)
ReferenceManager\CommonReferenceManager.Binding.cs (16)
96ImmutableArray<MetadataReference> explicitReferences, 103out ImmutableArray<MetadataReference> implicitlyResolvedReferences, 154implicitlyResolvedReferences = ImmutableArray<MetadataReference>.Empty; 212ImmutableArray<MetadataReference> explicitReferences, 220out ImmutableArray<MetadataReference> metadataReferences, 237var metadataReferencesBuilder = ArrayBuilder<MetadataReference>.GetInstance(); 239Dictionary<MetadataReference, MergedAliases>? lazyAliasMap = null; 242var referenceBindingsToProcess = ArrayBuilder<(MetadataReference, ArraySegment<AssemblyReferenceBinding>)>.GetInstance(); 294var existingReference = TryAddAssembly(resolvedAssemblyIdentity, resolvedReference, index, resolutionDiagnostics, Location.None, assemblyReferencesBySimpleName, supersedeLowerVersions); 323metadataReferences = ImmutableArray<MetadataReference>.Empty; 391ImmutableArray<MetadataReference> explicitReferences, 395[Out] ArrayBuilder<(MetadataReference, ArraySegment<AssemblyReferenceBinding>)> result) 407var moduleReference = explicitReferences[explicitModuleToReferenceMap[moduleIndex]]; 461ImmutableArray<MetadataReference> references, 462Dictionary<MetadataReference, MergedAliases>? propertyMapOpt, 525MetadataReference requestingReference,
ReferenceManager\CommonReferenceManager.Resolution.cs (40)
49protected abstract bool CheckPropertiesConsistency(MetadataReference primaryReference, MetadataReference duplicateReference, DiagnosticBag diagnostics); 63private readonly ImmutableArray<MetadataReference> _mergedReferencesOpt; 73_mergedReferencesOpt = default(ImmutableArray<MetadataReference>); 77public ResolvedReference(int index, MetadataImageKind kind, ImmutableArray<string> aliasesOpt, ImmutableArray<string> recursiveAliasesOpt, ImmutableArray<MetadataReference> mergedReferences) 119public ImmutableArray<MetadataReference> MergedReferences 174public readonly MetadataReference? Reference; 185public ReferencedAssemblyIdentity(AssemblyIdentity identity, MetadataReference reference, int relativeAssemblyIndex) 213out ImmutableArray<MetadataReference> references, 214out IDictionary<(string, string), MetadataReference> boundReferenceDirectiveMap, 215out ImmutableArray<MetadataReference> boundReferenceDirectives, 232Dictionary<MetadataReference, MergedAliases>? lazyAliasMap = null; 235var boundReferences = new Dictionary<MetadataReference, MetadataReference>(MetadataReferenceEqualityComparer.Instance); 237ArrayBuilder<MetadataReference>? uniqueDirectiveReferences = (referenceDirectiveLocations != null) ? ArrayBuilder<MetadataReference>.GetInstance() : null; 248var boundReference = references[referenceIndex]; 255MetadataReference? existingReference; 402boundReferenceDirectives = ImmutableArray<MetadataReference>.Empty; 439private static ResolvedReference GetResolvedReferenceAndFreePropertyMapEntry(MetadataReference reference, int index, MetadataImageKind kind, Dictionary<MetadataReference, MergedAliases>? propertyMapOpt) 442var mergedReferences = ImmutableArray<MetadataReference>.Empty; 570internal sealed class MetadataReferenceEqualityComparer : IEqualityComparer<MetadataReference> 574public bool Equals(MetadataReference? x, MetadataReference? y) 594public int GetHashCode(MetadataReference reference) 610private void MergeReferenceProperties(MetadataReference primaryReference, MetadataReference newReference, DiagnosticBag diagnostics, ref Dictionary<MetadataReference, MergedAliases>? lazyAliasMap) 619lazyAliasMap = new Dictionary<MetadataReference, MergedAliases>(); 663private MetadataReference? TryAddAssembly( 665MetadataReference reference, 791out ImmutableArray<MetadataReference> references, 792out IDictionary<(string, string), MetadataReference> boundReferenceDirectives, 795ArrayBuilder<MetadataReference> referencesBuilder = ArrayBuilder<MetadataReference>.GetInstance(); 797IDictionary<(string, string), MetadataReference>? localBoundReferenceDirectives = null; 819MetadataReference? boundReference = ResolveReferenceDirective(referenceDirective.File, referenceDirective.Location, compilation); 828localBoundReferenceDirectives = new Dictionary<(string, string), MetadataReference>(); 850localBoundReferenceDirectives = SpecializedCollections.EmptyDictionary<(string, string), MetadataReference>();
ReferenceManager\CommonReferenceManager.State.cs (46)
39internal abstract IEnumerable<KeyValuePair<MetadataReference, IAssemblySymbolInternal>> GetReferencedAssemblies(); 46internal abstract MetadataReference? GetMetadataReference(IAssemblySymbolInternal? assemblySymbol); 47internal abstract ImmutableArray<MetadataReference> ExplicitReferences { get; } 72internal readonly Dictionary<MetadataReference, MetadataOrDiagnostic> ObservedMetadata; 91private Dictionary<MetadataReference, int>? _lazyReferencedAssembliesMap; 101private Dictionary<MetadataReference, int>? _lazyReferencedModuleIndexMap; 107private IDictionary<(string, string), MetadataReference>? _lazyReferenceDirectiveMap; 118private ImmutableArray<MetadataReference> _lazyDirectiveReferences; 120private ImmutableArray<MetadataReference> _lazyExplicitReferences; 126/// For each such assembly identity <see cref="MetadataReferenceResolver.ResolveMissingAssembly(MetadataReference, AssemblyIdentity)"/> is called 184/// A map capturing <see cref="MetadataReference"/>s that were "merged" to a single referenced assembly 188private ImmutableDictionary<MetadataReference, ImmutableArray<MetadataReference>>? _lazyMergedAssemblyReferencesMap; 195public CommonReferenceManager(string simpleAssemblyName, AssemblyIdentityComparer identityComparer, Dictionary<MetadataReference, MetadataOrDiagnostic>? observedMetadata) 202this.ObservedMetadata = observedMetadata ?? new Dictionary<MetadataReference, MetadataOrDiagnostic>(); 223internal Dictionary<MetadataReference, int> ReferencedAssembliesMap 232internal Dictionary<MetadataReference, int> ReferencedModuleIndexMap 241internal IDictionary<(string, string), MetadataReference> ReferenceDirectiveMap 250internal ImmutableArray<MetadataReference> DirectiveReferences 268internal override ImmutableArray<MetadataReference> ExplicitReferences 324internal ImmutableDictionary<MetadataReference, ImmutableArray<MetadataReference>> MergedAssemblyReferencesMap 409Dictionary<MetadataReference, int> referencedAssembliesMap, 410Dictionary<MetadataReference, int> referencedModulesMap, 411IDictionary<(string, string), MetadataReference> boundReferenceDirectiveMap, 412ImmutableArray<MetadataReference> directiveReferences, 413ImmutableArray<MetadataReference> explicitReferences, 423Dictionary<MetadataReference, ImmutableArray<MetadataReference>>? mergedAssemblyReferencesMapOpt) 444_lazyMergedAssemblyReferencesMap = mergedAssemblyReferencesMapOpt?.ToImmutableDictionary() ?? ImmutableDictionary<MetadataReference, ImmutableArray<MetadataReference>>.Empty; 461ImmutableArray<MetadataReference> references, 467out Dictionary<MetadataReference, int> referencedAssembliesMap, 468out Dictionary<MetadataReference, int> referencedModulesMap, 470out Dictionary<MetadataReference, ImmutableArray<MetadataReference>>? mergedAssemblyReferencesMapOpt) 472referencedAssembliesMap = new Dictionary<MetadataReference, int>(referenceMap.Length); 473referencedModulesMap = new Dictionary<MetadataReference, int>(referencedModuleCount); 498MetadataReference reference = references[i]; 504(mergedAssemblyReferencesMapOpt ??= new Dictionary<MetadataReference, ImmutableArray<MetadataReference>>()).Add(reference, referenceMap[i].MergedReferences); 680internal sealed override IEnumerable<KeyValuePair<MetadataReference, IAssemblySymbolInternal>> GetReferencedAssemblies() 685internal TAssemblySymbol? GetReferencedAssemblySymbol(MetadataReference reference) 691internal int GetReferencedModuleIndex(MetadataReference reference) 698/// Gets the <see cref="MetadataReference"/> that corresponds to the assembly symbol. 700internal override MetadataReference? GetMetadataReference(IAssemblySymbolInternal? assemblySymbol)
ReferenceManager\MergedAliases.cs (3)
15public ArrayBuilder<MetadataReference>? MergedReferencesOpt; 34internal void Merge(MetadataReference reference) 64(MergedReferencesOpt ??= ArrayBuilder<MetadataReference>.GetInstance()).Add(reference);
SourceGeneration\IncrementalContexts.cs (2)
66public IncrementalValuesProvider<MetadataReference> MetadataReferencesProvider => new IncrementalValuesProvider<MetadataReference>(SharedInputNodes.MetadataReferences.WithRegisterOutput(RegisterOutput).WithTrackingName(WellKnownGeneratorInputs.MetadataReferences), CatchAnalyzerExceptions);
SourceGeneration\Nodes\SharedInputNodes.cs (2)
30public static readonly InputNode<MetadataReference> MetadataReferences = new InputNode<MetadataReference>(b => b.Compilation.ExternalReferences);
Microsoft.CodeAnalysis.CSharp (50)
Compilation\CSharpCompilation.cs (27)
359IEnumerable<MetadataReference>? references = null, 379IEnumerable<MetadataReference>? references = null, 403IEnumerable<MetadataReference>? references, 454ImmutableArray<MetadataReference> references, 471ImmutableArray<MetadataReference> references, 618/// The new <see cref="CSharpCompilation"/> will query the given <see cref="MetadataReference"/> for the underlying 621/// The new compilation uses whatever metadata is currently being provided by the <see cref="MetadataReference"/>. 625public new CSharpCompilation WithReferences(IEnumerable<MetadataReference>? references) 647public new CSharpCompilation WithReferences(params MetadataReference[] references) 649return this.WithReferences((IEnumerable<MetadataReference>)references); 1161public override ImmutableArray<MetadataReference> DirectiveReferences 1169internal override IDictionary<(string path, string content), MetadataReference> ReferenceDirectiveMap 1188internal new Symbol? GetAssemblyOrModuleSymbol(MetadataReference reference) 1233public MetadataReference? GetDirectiveReference(ReferenceDirectiveTriviaSyntax directive) 1237MetadataReference? reference; 1244public new CSharpCompilation AddReferences(params MetadataReference[] references) 1252public new CSharpCompilation AddReferences(IEnumerable<MetadataReference> references) 1260public new CSharpCompilation RemoveReferences(params MetadataReference[] references) 1268public new CSharpCompilation RemoveReferences(IEnumerable<MetadataReference> references) 1284public new CSharpCompilation ReplaceReference(MetadataReference oldReference, MetadataReference newReference) 1342/// Gets the <see cref="MetadataReference"/> that corresponds to the assembly symbol. 1344public new MetadataReference? GetMetadataReference(IAssemblySymbol assemblySymbol) 1349private protected override MetadataReference? CommonGetMetadataReference(IAssemblySymbol assemblySymbol) 1359internal MetadataReference? GetMetadataReference(AssemblySymbol? assemblySymbol) 3900protected override Compilation CommonWithReferences(IEnumerable<MetadataReference> newReferences) 3974protected override ISymbol? CommonGetAssemblyOrModuleSymbol(MetadataReference reference)
Errors\MessageProvider.cs (4)
205public override void ReportDuplicateMetadataReferenceStrong(DiagnosticBag diagnostics, Location location, MetadataReference reference, AssemblyIdentity identity, MetadataReference equivalentReference, AssemblyIdentity equivalentIdentity) 212public override void ReportDuplicateMetadataReferenceWeak(DiagnosticBag diagnostics, Location location, MetadataReference reference, AssemblyIdentity identity, MetadataReference equivalentReference, AssemblyIdentity equivalentIdentity)
Symbols\Compilation_UsedAssemblies.cs (9)
23public override ImmutableArray<MetadataReference> GetUsedAssemblyReferences(CancellationToken cancellationToken = default) 29return ImmutableArray<MetadataReference>.Empty; 32var setOfReferences = new HashSet<MetadataReference>(ReferenceEqualityComparer.Instance); 33ImmutableDictionary<MetadataReference, ImmutableArray<MetadataReference>> mergedAssemblyReferencesMap = GetBoundReferenceManager().MergedAssemblyReferencesMap; 35foreach (var reference in References) 42mergedAssemblyReferencesMap.TryGetValue(reference, out ImmutableArray<MetadataReference> merged)) 51var builder = ArrayBuilder<MetadataReference>.GetInstance(setOfReferences.Count); 53foreach (var reference in References)
Symbols\ReferenceManager.cs (10)
58public ReferenceManager(string simpleAssemblyName, AssemblyIdentityComparer identityComparer, Dictionary<MetadataReference, MetadataOrDiagnostic>? observedMetadata) 103protected override bool CheckPropertiesConsistency(MetadataReference primaryReference, MetadataReference duplicateReference, DiagnosticBag diagnostics) 351IDictionary<(string, string), MetadataReference>? boundReferenceDirectiveMap; 352ImmutableArray<MetadataReference> boundReferenceDirectives; 355ImmutableArray<MetadataReference> explicitReferences; 373ImmutableArray<MetadataReference> implicitlyResolvedReferences; 404Dictionary<MetadataReference, int> referencedAssembliesMap, referencedModulesMap; 406Dictionary<MetadataReference, ImmutableArray<MetadataReference>>? mergedAssemblyReferencesMapOpt;
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (9)
CommandLineTestBase.cs (2)
55internal MockCSharpCompiler CreateCSharpCompiler(string[] args, DiagnosticAnalyzer[]? analyzers = null, ISourceGenerator[]? generators = null, AnalyzerAssemblyLoader? loader = null, GeneratorDriverCache? driverCache = null, MetadataReference[]? additionalReferences = null) 60internal MockCSharpCompiler CreateCSharpCompiler(string? responseFile, string workingDirectory, string[] args, DiagnosticAnalyzer[]? analyzers = null, ISourceGenerator[]? generators = null, AnalyzerAssemblyLoader? loader = null, GeneratorDriverCache? driverCache = null, MetadataReference[]? additionalReferences = null)
CommandLineTests.cs (7)
12123new MetadataReference[] { NetStandard13.References.SystemRuntime }, 12126var minSystemCollectionsImmutableRef = MetadataReference.CreateFromImage(minSystemCollectionsImmutableImage); 12131new MetadataReference[] 12138var minCodeAnalysisRef = MetadataReference.CreateFromImage(minCodeAnalysisImage); 12219new MetadataReference[] 14237references: TargetFrameworkUtil.NetStandard20References.Add(MetadataReference.CreateFromAssemblyInternal(typeof(ISourceGenerator).Assembly)), 15387TargetFrameworkUtil.GetReferences(TargetFramework.Standard, new[] { MetadataReference.CreateFromAssemblyInternal(typeof(ISourceGenerator).Assembly) }),
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (14)
CodeActions\PreviewTests.cs (1)
76var removedReference = _oldDocument.Project.MetadataReferences[_oldDocument.Project.MetadataReferences.Count - 1];
Completion\CompletionProviders\OverrideCompletionProviderTests.cs (2)
3189var reference = MetadataReference.CreateFromImage(compilation.EmitToArray()); 3242var libRef = MetadataReference.CreateFromImage(libComp.EmitToArray());
PdbSourceDocument\AbstractPdbSourceDocumentTests.cs (1)
228project = project.AddMetadataReference(MetadataReference.CreateFromFile(GetDllPath(path)));
PdbSourceDocument\ImplementationAssemblyLookupServiceTests.cs (8)
184implProject = implProject.AddMetadataReference(MetadataReference.CreateFromFile(dllFilePath)); 244implProject = implProject.AddMetadataReference(MetadataReference.CreateFromFile(dllFilePath)); 305implProject = implProject.AddMetadataReference(MetadataReference.CreateFromFile(dllFilePath)); 360implProject = implProject.AddMetadataReference(MetadataReference.CreateFromFile(dllFilePath)); 411implProject = implProject.AddMetadataReference(MetadataReference.CreateFromFile(dllFilePath)); 476implProject = implProject.AddMetadataReference(MetadataReference.CreateFromFile(dllFilePath)); 534implProject = workspace.CurrentSolution.Projects.First().AddMetadataReference(MetadataReference.CreateFromFile(dllFilePath)); 548implProject = workspace.CurrentSolution.Projects.First().AddMetadataReference(MetadataReference.CreateFromFile(realImplementationDllFilePath));
PdbSourceDocument\PdbSourceDocumentTests.cs (2)
547implProject = implProject.AddMetadataReference(MetadataReference.CreateFromFile(implementationDllFilePath)); 943project = project.AddMetadataReference(MetadataReference.CreateFromFile(GetDllPath(path)));
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (261)
BreakingChanges.cs (1)
1581var libRef = CreateCompilation(libSource, assemblyName: "lib").EmitToImageReference();
CodeGen\CodeGenAsyncEHTests.cs (2)
20private static readonly MetadataReference[] s_asyncRefs = new[] { MscorlibRef_v4_0_30316_17626, SystemRef_v4_0_30319_17929, SystemCoreRef_v4_0_30319_17929 }; 26private CompilationVerifier CompileAndVerify(string source, string expectedOutput = null, IEnumerable<MetadataReference> references = null, CSharpCompilationOptions options = null)
CodeGen\CodeGenAsyncIteratorTests.cs (2)
116var lib_ref = lib.EmitToImageReference(); 133var lib_ref = lib.EmitToImageReference();
CodeGen\CodeGenAsyncLocalsTests.cs (4)
21private static readonly MetadataReference[] s_asyncRefs = new[] { MscorlibRef_v4_0_30316_17626, SystemRef_v4_0_30319_17929, SystemCoreRef_v4_0_30319_17929 }; 27private CompilationVerifier CompileAndVerify(string source, string expectedOutput = null, IEnumerable<MetadataReference> references = null, CSharpCompilationOptions options = null, Verification verify = default) 961var reference = CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { SystemRef_v4_0_30319_17929 }).EmitToImageReference();
CodeGen\CodeGenAsyncSpillTests.cs (1)
23private CompilationVerifier CompileAndVerify(string source, string expectedOutput = null, IEnumerable<MetadataReference> references = null, CSharpCompilationOptions options = null)
CodeGen\CodeGenAsyncTests.cs (5)
26private static CSharpCompilation CreateCompilation(string source, IEnumerable<MetadataReference> references = null, CSharpCompilationOptions options = null) 30IEnumerable<MetadataReference> asyncRefs = new[] { NetFramework.System, NetFramework.SystemCore, NetFramework.MicrosoftCSharp }; 36private CompilationVerifier CompileAndVerify(string source, string expectedOutput, IEnumerable<MetadataReference> references = null, CSharpCompilationOptions options = null, Verification verify = default) 3711var rB = cB.EmitToImageReference(); 3722var rT = cT.EmitToImageReference();
CodeGen\CodeGenConversionTests.cs (2)
284var comp2 = CreateCompilation(source2, new[] { MetadataReference.CreateFromImage(verifier1.EmittedAssemblyData) }, TestOptions.ReleaseExe); 382var comp2 = CreateCompilation(source2, new[] { MetadataReference.CreateFromImage(verifier1.EmittedAssemblyData) }, TestOptions.ReleaseExe);
CodeGen\CodeGenDeconstructTests.cs (1)
22private static readonly MetadataReference[] s_valueTupleRefs = new[] { SystemRuntimeFacadeRef, ValueTupleRef };
CodeGen\CodeGenDynamicTests.cs (24)
31MetadataReference[] references = null, 129private MetadataReference MakeCSharpRuntime(string excludeBinder = null, bool excludeBinderFlags = false, bool excludeArgumentInfoFlags = false, MetadataReference systemCore = null) 233var csrtRef = MakeCSharpRuntime(excludeBinder: "InvokeConstructor"); 256var csrtRef = MakeCSharpRuntime(excludeBinderFlags: true, excludeArgumentInfoFlags: true); 277var systemCoreRef = CreateCompilationWithMscorlib40(SystemCoreSource, assemblyName: GetUniqueName()).EmitToImageReference(); 278var csrtRef = MakeCSharpRuntime(systemCore: systemCoreRef); 296var systemCoreRef = CreateCompilationWithMscorlib40(SystemCoreSource, assemblyName: GetUniqueName()).EmitToImageReference(); 297var csrtRef = MakeCSharpRuntime(systemCore: systemCoreRef); 298var funcRef = MetadataReference.CreateFromImage(TestResources.MetadataTests.Invalid.InvalidFuncDelegateName.AsImmutableOrNull()); 317var systemCoreRef = CreateCompilationWithMscorlib40(SystemCoreSource, assemblyName: GetUniqueName()).EmitToImageReference(); 318var csrtRef = MakeCSharpRuntime(systemCore: systemCoreRef); 456var systemCoreRef = CreateCompilationWithMscorlib40(systemCoreSource, assemblyName: GetUniqueName()).EmitToImageReference(); 457var csrtRef = MakeCSharpRuntime(systemCore: systemCoreRef); 485var systemCoreRef = CreateCompilationWithMscorlib40(systemCoreSource, assemblyName: GetUniqueName()).EmitToImageReference(); 486var csrtRef = MakeCSharpRuntime(systemCore: systemCoreRef); 11468var vbRef = vb.EmitToImageReference(); 11486CompileAndVerifyIL(source, "C.M", references: new MetadataReference[] { SystemCoreRef, CSharpRef, vbRef }, expectedOptimizedIL: @" 11570var vbRef = vb.EmitToImageReference(); 11588CompileAndVerifyIL(source, "C.M", references: new MetadataReference[] { SystemCoreRef, CSharpRef, vbRef }, expectedOptimizedIL: @" 11679var vbRef = vb.EmitToImageReference(); 11697CompileAndVerifyIL(source, "C.M", references: new MetadataReference[] { SystemCoreRef, CSharpRef, vbRef }, expectedOptimizedIL: @" 11849var ilRef = MetadataReference.CreateFromImage(TestResources.MetadataTests.Interop.IndexerWithByRefParam.AsImmutableOrNull()); 11871CompileAndVerifyIL(source, "C.M", references: new MetadataReference[] { SystemCoreRef, CSharpRef, ilRef }, expectedOptimizedIL: @"
CodeGen\CodeGenExplicitImplementationTests.cs (2)
219references: new MetadataReference[] 378references: new MetadataReference[] { asm01, new CSharpCompilationReference(comp1) },
CodeGen\CodeGenExprLambdaTests.cs (5)
22MetadataReference[] references = null, 31protected static MetadataReference ExpressionAssemblyRef => SystemCoreRef_v46; 5263var reference1 = BasicCompilationUtils.CompileToMetadata(source1, verify: Verification.Passes); 6020var reference1 = compilation1.EmitToImageReference(); 6067var reference1 = compilation1.EmitToImageReference();
CodeGen\CodeGenFunctionPointersTests.cs (13)
30MetadataReference[]? references = null, 46private static CSharpCompilation CreateCompilationWithFunctionPointers(CSharpTestSource source, IEnumerable<MetadataReference>? references = null, CSharpCompilationOptions? options = null, TargetFramework? targetFramework = null) 2526var nopiaReference = CreateCompilation(NoPiaInterfaces).EmitToImageReference(embedInteropTypes: true); 2559var nopiaReference = CreateCompilation(NoPiaInterfaces).EmitToImageReference(embedInteropTypes: true); 2586var nopiaReference = CreateCompilation(NoPiaInterfaces).EmitToImageReference(embedInteropTypes: true); 2588var intermediate = CreateCompilation(@" 2619var aRef = CreateCompilation(@" 2624var bRef = CreateCompilation(@" 2650var aRef = CreateCompilation(@" 2654var bRef = CreateCompilation(@" 4071var invalidAttributeReference = MetadataReference.CreateFromStream(peStream); 6280var metadataRef = baseComp.EmitToImageReference(); 8669static void validate(MetadataReference reference)
CodeGen\CodeGenImplicitlyTypeArraysTests.cs (2)
284var mscorlib17626 = MetadataReference.CreateFromImage(Net461.Resources.mscorlib); 285CompileAndVerify(testSrc, new MetadataReference[] { mscorlib17626 }, expectedOutput: "1", targetFramework: TargetFramework.Empty);
CodeGen\CodeGenInterfaceImplementation.cs (1)
370references: new MetadataReference[] { asmRef, new CSharpCompilationReference(comp1), new CSharpCompilationReference(comp2) },
CodeGen\CodeGenMscorlib.cs (6)
248var reference1 = MetadataReference.CreateFromStream(compilation1.EmitToStream()); 282var reference1 = MetadataReference.CreateFromStream(compilation1.EmitToStream()); 319var reference1 = MetadataReference.CreateFromStream(compilation1.EmitToStream()); 357var reference1 = MetadataReference.CreateFromStream(compilation1.EmitToStream()); 416var reference1 = MetadataReference.CreateFromStream(compilation1.EmitToStream()); 478var reference1 = MetadataReference.CreateFromStream(compilation1.EmitToStream());
CodeGen\CodeGenNullCoalescingAssignmentTests.cs (3)
2522var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 2669var aRef = CreateCompilation(aSource).EmitToImageReference(); 2671var bRef = CreateCompilation(bSource, new[] { aRef }).EmitToImageReference();
CodeGen\CodeGenOverridingAndHiding.cs (9)
2827var refs = new System.Collections.Generic.List<MetadataReference>() { asm01, asm02 }; 2920var refs = new System.Collections.Generic.List<MetadataReference>() { asm01, asm02 }; 2989references: new MetadataReference[] { asm01, asm02, new CSharpCompilationReference(comp1) }, 3158var refs = new System.Collections.Generic.List<MetadataReference>() { asm01, asm02 }; 3373references: new MetadataReference[] { asm01, asm02 }, 3378references: new MetadataReference[] { asm01, asm02, new CSharpCompilationReference(comp1) }, 3383references: new MetadataReference[] { asm01, asm02, new CSharpCompilationReference(comp1), new CSharpCompilationReference(comp2) }, 3487references: new MetadataReference[] { asmfile, new CSharpCompilationReference(comp1), new CSharpCompilationReference(comp2) }, 4016var references = new MetadataReference[] { TestReferences.SymbolsTests.Methods.ILMethods };
CodeGen\CodeGenReadonlyStructTests.cs (6)
108var ref1 = comp1.EmitToImageReference(); 326var ref1 = comp1.EmitToImageReference(); 996var ref1 = comp1.EmitToImageReference(); 1671var ilRef = CompileIL(il); 1831var image = CreateCompilation(external).EmitToImageReference(); 1907var image = CreateCompilation(external).EmitToImageReference();
CodeGen\CodeGenRefReturnTests.cs (1)
2479var ref1 = CompileIL(ilSource);
CodeGen\CodeGenScriptTests.cs (1)
236MetadataReference[] references = { SystemCoreRef, CSharpRef };
CodeGen\CodeGenShortCircuitOperatorTests.cs (2)
2631var comp = CompileAndVerify(source, references: new MetadataReference[] { CSharpRef }, expectedOutput: @"False 2690var comp = CompileAndVerify(source, references: new MetadataReference[] { CSharpRef }, expectedOutput: @"False
CodeGen\CodeGenTests.cs (1)
13543var reference = CompileIL(il);
CodeGen\CodeGenTupleTest.cs (23)
32private static readonly MetadataReference[] s_valueTupleRefs = new[] { SystemRuntimeFacadeRef, ValueTupleRef }; 19059var comp = (Compilation)CSharpCompilation.Create("test", syntaxTrees: new[] { tree }, references: new[] { (MetadataReference)Net40.References.mscorlib, tupleComp1.ToMetadataReference() }); 19098var comp = (Compilation)CSharpCompilation.Create("test", syntaxTrees: new[] { tree }, references: new[] { (MetadataReference)Net40.References.mscorlib, tupleComp1.ToMetadataReference() }); 23174var ref0 = comp0.EmitToImageReference(); 23192var ref1 = comp1.EmitToImageReference(); 23222var ref0v1 = comp0v1.EmitToImageReference(); 23230var ref0v2 = comp0v2.EmitToImageReference(); 23237var ref1 = comp1.EmitToImageReference(); 23248var ref2 = comp2.EmitToImageReference(); 23820var libCompRef = CompileIL(lib); 25318var corlibWithoutVTRef = corlibWithoutVT.EmitToImageReference(); 25322var corlibWithVTRef = corlibWithVT.EmitToImageReference(); 25326var libWithVTRef = libWithVT.EmitToImageReference(); 25344var libWithVTRef2 = CreateEmptyCompilation(valuetuple_cs, references: new[] { corlibWithoutVTRef }, parseOptions: parseOptions).EmitToImageReference(); 26422var libRef = useImageReference ? lib.EmitToImageReference() : lib.ToMetadataReference(); 26466var missingContainerRef = useImageReference ? missingContainer.EmitToImageReference() : missingContainer.ToMetadataReference(); 26484var libRef = useImageReference ? lib.EmitToImageReference() : lib.ToMetadataReference(); 26529var missingContainerRef = useImageReference ? missingContainer.EmitToImageReference() : missingContainer.ToMetadataReference(); 26543var libRef = useImageReference ? lib.EmitToImageReference() : lib.ToMetadataReference(); 26590var missingRef = useImageReference ? missing.EmitToImageReference() : missing.ToMetadataReference(); 26608var libRef = useImageReference ? lib.EmitToImageReference() : lib.ToMetadataReference(); 26642var refA = comp.EmitToImageReference(); 26647var refB = comp.EmitToImageReference();
CodeGen\EventTests.cs (2)
620var compilation = CreateCompilation(csharpSource, new MetadataReference[] { ilAssemblyReference }, TestOptions.ReleaseExe); 647var reference1 = MetadataReference.CreateFromStream(compilation1.EmitToStream());
CodeGen\FixedSizeBufferTests.cs (2)
573references: new MetadataReference[] { MetadataReference.CreateFromStream(comp1.EmitToStream()) },
CodeGen\ForLoopsTests.cs (1)
1546CompileAndVerify(text, references: new MetadataReference[] { CSharpRef }, expectedOutput: @"Initialize
CodeGen\SwitchTests.cs (1)
3039var reference = compVerifier.Compilation.EmitToImageReference();
CodeGen\WinMdDelegateTests.cs (2)
142var winRtDelegateLibrary = CreateEmptyCompilation( 150var nonWinRtDelegateLibrary = CreateEmptyCompilation(
Emit\BinaryCompatibility.cs (3)
34var lib0Image = CreateCompilationWithMscorlib46(lib0, options: TestOptions.ReleaseDll, assemblyName: "lib").EmitToImageReference(); 46var lib1Image = CreateCompilationWithMscorlib46(lib1, options: TestOptions.ReleaseDll, assemblyName: "lib").EmitToImageReference(); 58var clientImage = CreateCompilationWithMscorlib46(client, references: new[] { lib0Image }, options: TestOptions.ReleaseDll).EmitToImageReference();
Emit\CompilationEmitTests.cs (74)
235CSharpCompilation compUsing = CreateCompilation(srcUsing, new[] { MetadataReference.CreateFromImage(mdOnlyImage.AsImmutableOrNull()) }); 1033var piaImageReference = pia.EmitToImageReference(embedInteropTypes: true); 1041void verifyRefOnly(MetadataReference reference) 1044references: new MetadataReference[] { reference }); 1049void verifyRefOut(MetadataReference reference) 1052references: new MetadataReference[] { reference }); 1060var reference = CompilationVerifier.LoadTestEmittedExecutableForSymbolValidation(image, OutputKind.DynamicallyLinkedLibrary); 1112var piaImageReference = pia.EmitToImageReference(embedInteropTypes: true); 1120void verifyRefOnly(MetadataReference reference) 1123references: new MetadataReference[] { reference }); 1128void verifyRefOut(MetadataReference reference) 1131references: new MetadataReference[] { reference }); 1142var reference = CompilationVerifier.LoadTestEmittedExecutableForSymbolValidation(image, OutputKind.DynamicallyLinkedLibrary); 1808var image1 = comp1.EmitToImageReference(EmitOptions.Default); 1816var image2 = comp2.EmitToImageReference(EmitOptions.Default.WithEmitMetadataOnly(true).WithIncludePrivateMembers(false)); 1890var libImage = libComp.EmitToImageReference(emitOptions); 2131var realImage = comp.EmitToImageReference(EmitOptions.Default); 2162var realImage2 = comp.EmitToImageReference(emitRegularWithoutPrivateMembers); 2190var metadataImage = comp.EmitToImageReference(emitMetadataOnly); 2219var refImage = comp.EmitToImageReference(emitRefOnly); 2268var realImage = comp.EmitToImageReference(EmitOptions.Default); 2278var metadataImage = comp.EmitToImageReference(emitMetadataOnly); 2290var refImage = comp.EmitToImageReference(emitRefOnly); 2335var realImage = comp.EmitToImageReference(EmitOptions.Default); 2345var metadataImage = comp.EmitToImageReference(emitMetadataOnly); 2357var refImage = comp.EmitToImageReference(emitRefOnly); 2402var realImage = comp.EmitToImageReference(EmitOptions.Default); 2412var metadataImage = comp.EmitToImageReference(emitMetadataOnly); 2424var refImage = comp.EmitToImageReference(emitRefOnly); 2463var refImage = comp.EmitToImageReference(emitRefOnly); 2508var refImage = comp.EmitToImageReference(emitRefOnly); 2698references: new MetadataReference[] { ilAssemblyReference }, 2740var libAssemblyReference = MetadataReference.CreateFromImage(dllImage.AsImmutableOrNull()); 2756references: new MetadataReference[] { ilAssemblyReference, libAssemblyReference }, 4611CompileAndVerify(p2, new[] { MetadataReference.CreateFromStream(c1.EmitToStream()) }, expectedOutput: "0"); 4682var imageRef = refCompilation.EmitToImageReference(); 4691new MetadataReference[] { compRef }, 4697new MetadataReference[] { imageRef }, 4703new MetadataReference[] { compRef }, 4709new MetadataReference[] { imageRef }, 4715new MetadataReference[] { compRef }, 4723new MetadataReference[] { imageRef }, 4731new MetadataReference[] { compRef }, 4739new MetadataReference[] { imageRef }, 4766var imageRef = refCompilation.EmitToImageReference(); 4775new MetadataReference[] { imageRef }, 4783new MetadataReference[] { imageRef }, 4791new MetadataReference[] { imageRef }, 4812var imageRef = refCompilation.EmitToImageReference(); 4822new MetadataReference[] { compRef }, 4830new MetadataReference[] { imageRef }, 4838new MetadataReference[] { compRef }, 4846new MetadataReference[] { imageRef }, 4867var imageRef = refCompilation.EmitToImageReference(); 4877new MetadataReference[] { imageRef }, 4899var imageRef = refCompilation.EmitToImageReference(); 4909new MetadataReference[] { compRef }, 4915new MetadataReference[] { imageRef }, 4921new MetadataReference[] { compRef }, 4927new MetadataReference[] { imageRef }, 4946var imageRef = refCompilation.EmitToImageReference(); 4956new MetadataReference[] { imageRef }, 4976var imageRef = refCompilation.EmitToImageReference(); 4986new MetadataReference[] { compRef }, 4992new MetadataReference[] { imageRef }, 4998new MetadataReference[] { compRef }, 5004new MetadataReference[] { imageRef }, 5024var imageRef = refCompilation.EmitToImageReference(); 5034new MetadataReference[] { imageRef }, 5264var ref1 = comp1.EmitToImageReference(); 5268var ref2 = comp2.EmitToImageReference(); 5311var ref1 = comp1.EmitToImageReference(); 5315var ref2 = comp2.EmitToImageReference(); 5549var modRef = CreateCompilation("public class A { }", options: TestOptions.ReleaseModule, assemblyName: "refMod").EmitToImageReference();
Emit\CovariantReturnTests.cs (10)
18private static MetadataReference _corelibraryWithCovariantReturnSupport; 19private static MetadataReference CorelibraryWithCovariantReturnSupport 32private static MetadataReference MakeCorelibraryWithCovariantReturnSupport() 237IEnumerable<MetadataReference> references = null, 337var csharpReference = csharpCompilation.EmitToImageReference(); 393var csharpReference = csharpCompilation.EmitToImageReference(); 495var ref0 = CreateCovariantCompilation( 504var ref1a = CreateCovariantCompilation( 515var ref1b = CreateCovariantCompilation( 526var ref2 = CreateCovariantCompilation(
Emit\DeterministicTests.cs (3)
267new[] { MetadataReference.CreateFromAssemblyInternal(typeof(object).Assembly) }, 317var forwardingCompilation = CreateCompilation(forwardingCode, new MetadataReference[] { forwardedToReference1 }); 355var withRetargeting = CreateCompilation("", new MetadataReference[] { forwardedToReference2, forwardingReference });
Emit\EmitCustomModifiers.cs (8)
103references: new MetadataReference[] { ilAssemblyReference }, 162references: new MetadataReference[] { ilAssemblyReference }, 214references: new MetadataReference[] { ilAssemblyReference }, 285references: new MetadataReference[] { ilAssemblyReference }, 378references: new MetadataReference[] { ilAssemblyReference }, 460references: new MetadataReference[] { ilAssemblyReference }, 512references: new MetadataReference[] { ilAssemblyReference }, 555references: new MetadataReference[] { ilAssemblyReference },
Emit\EmitErrorTests.cs (3)
237var compilation2 = CreateCompilation(source2, new MetadataReference[] { new CSharpCompilationReference(compilation1) }); 270var compilationOK = CreateCompilation(source, new MetadataReference[] { moduleMetadata.GetReference(filePath: @"R:\A\B\ModuleNameMismatch.netmodule") }); 274var compilationError = CreateCompilation(source, new MetadataReference[] { moduleMetadata.GetReference(filePath: @"R:\A\B\ModuleNameMismatch.mod") });
Emit\EmitMetadataTests.cs (1)
2731var reference = CompileIL(@"
Emit\EntryPointTests.cs (1)
1576new MetadataReference[] { netModule.EmitToImageReference() },
Emit\InAttributeModifierTests.cs (30)
243var reference = CompileIL(ilSource, prependDefaultHeader: false); 297var reference = CompileIL(ilSource, prependDefaultHeader: false); 353var reference = CompileIL(ilSource, prependDefaultHeader: false); 405var reference = CompileIL(ilSource, prependDefaultHeader: false); 466var reference = CompileIL(ilSource, prependDefaultHeader: false); 515var reference = CompileIL(ilSource, prependDefaultHeader: false); 567var reference = CompileIL(ilSource, prependDefaultHeader: false); 621var reference = CompileIL(ilSource, prependDefaultHeader: false); 678var reference = CompileIL(ilSource, prependDefaultHeader: false); 737var reference = CompileIL(ilSource, prependDefaultHeader: false); 807var reference = CompileIL(ilSource, prependDefaultHeader: false); 887var reference = CompileIL(ilSource, prependDefaultHeader: false); 954var reference = CompileIL(ilSource, prependDefaultHeader: false); 1012var reference = CompileIL(ilSource, prependDefaultHeader: false); 1072var reference = CompileIL(ilSource, prependDefaultHeader: false); 1129var reference = CompileIL(ilSource, prependDefaultHeader: false); 1188var reference = CompileIL(ilSource, prependDefaultHeader: false); 1258var reference = CompileIL(ilSource, prependDefaultHeader: false); 1338var reference = CompileIL(ilSource, prependDefaultHeader: false); 1406var reference = CompileIL(ilSource, prependDefaultHeader: false); 1464var reference = CompileIL(ilSource, prependDefaultHeader: false); 3919var reference = CompileIL(ilSource, prependDefaultHeader: false); 3981var reference = CompileIL(ilSource, prependDefaultHeader: false); 4056var reference = CompileIL(ilSource, prependDefaultHeader: false); 4142var reference = CompileIL(ilSource, prependDefaultHeader: false); 4414var ref1 = CreateCompilation(refCode).EmitToImageReference(); 4415var ref2 = CreateCompilation(refCode).EmitToImageReference(); 4457var corlibWithoutInAttributeRef = CreateEmptyCompilation(corlib_cs).EmitToImageReference(); 4465var ref1 = CreateEmptyCompilation(refCode, references: new[] { corlibWithoutInAttributeRef }).EmitToImageReference(); 4466var ref2 = CreateEmptyCompilation(refCode, references: new[] { corlibWithoutInAttributeRef }).EmitToImageReference();
Emit\OptionalArgumentsTests.cs (1)
184references: new[] { MetadataReference.CreateFromStream(comp1.EmitToStream()) },
PrivateProtected.cs (2)
189references: new[] { MetadataReference.CreateFromImage(baseCompilation.EmitToArray()) }, 247references: new[] { MetadataReference.CreateFromImage(baseCompilation.EmitToArray()) },
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (74)
CodeGen\CodeGenSpanBasedStringConcatTests.cs (9)
639var corlib = CreateEmptyCompilation(corlib_cs).EmitToImageReference(); 714var corlib = CreateEmptyCompilation(corlib_cs).EmitToImageReference(); 788var corlib = CreateEmptyCompilation(corlib_cs).EmitToImageReference(); 2180var corlib = CreateEmptyCompilation(corlib_cs).EmitToImageReference(); 2258var corlib = CreateEmptyCompilation(corlib_cs).EmitToImageReference(); 2335var corlib = CreateEmptyCompilation(corlib_cs).EmitToImageReference(); 4833var corlib = CreateEmptyCompilation(corlib_cs).EmitToImageReference(); 4914var corlib = CreateEmptyCompilation(corlib_cs).EmitToImageReference(); 4994var corlib = CreateEmptyCompilation(corlib_cs).EmitToImageReference();
Emit\EditAndContinue\EditAndContinueTest.cs (2)
22IEnumerable<MetadataReference>? references = null, 30private readonly IEnumerable<MetadataReference>? _references = references;
Emit\EditAndContinue\EditAndContinueTests.cs (4)
11723var referencePIA = compilationPIA.EmitToImageReference(embedInteropTypes: true); 11776var referencePIA = compilationPIA.EmitToImageReference(embedInteropTypes: true); 11862var referencePIA = compilationPIA.EmitToImageReference(embedInteropTypes: true); 11950var referencePIA = compilationPIA.EmitToImageReference(embedInteropTypes: true);
Emit\EditAndContinue\SymbolMatcherTests.cs (8)
31var reference = compilation.EmitToImageReference(); 184var metadataRef = CompileIL(ilSource); 547var peRef0 = compilation0.EmitToImageReference(); 945var peRef0 = compilation0.EmitToImageReference(); 1102var peRef0 = compilation0.EmitToImageReference(); 1523var peRef0 = compilation0.EmitToImageReference(); 1583var peRef0 = compilation0.EmitToImageReference(); 1653var peRef0 = compilation0.EmitToImageReference();
Emit\NumericIntPtrTests.cs (16)
235var refA = AsReference(comp, useCompilationReference); 330var refA = AsReference(comp, useCompilationReference); 443var refA = AsReference(comp, useCompilationReference); 542var refA = AsReference(comp, useCompilationReference); 627var refA = AsReference(comp, useCompilationReference); 811var refA = AsReference(comp, useCompilationReference); 939var ref2 = comp.EmitToImageReference(); 1001var ref2 = comp.EmitToImageReference(); 1194var ref2 = comp.EmitToImageReference(); 1740var refA = AsReference(comp, useCompilationReference); 2812var ref0 = comp.EmitToImageReference(); 2842var ref0 = comp.EmitToImageReference(); 3057var ref2 = comp.EmitToImageReference(); 9031var refA = comp.EmitToImageReference(); 10670var refA = AsReference(comp, useCompilationReference); 10722var image = comp.EmitToImageReference();
Emit\UnmanagedTypeModifierTests.cs (16)
59var reference = CompileIL(ilSource, prependDefaultHeader: false); 128var reference = CompileIL(ilSource, prependDefaultHeader: false); 197var reference = CompileIL(ilSource, prependDefaultHeader: false); 264var reference = CompileIL(ilSource, prependDefaultHeader: false); 331var reference = CompileIL(ilSource, prependDefaultHeader: false); 391var reference = CompileIL(ilSource, prependDefaultHeader: false); 1108var ref1 = CreateCompilation(refCode).EmitToImageReference(); 1109var ref2 = CreateCompilation(refCode).EmitToImageReference(); 1143var corlibWithoutUnmanagedTypeRef = CreateEmptyCompilation(corlib_cs).EmitToImageReference(); 1151var ref1 = CreateEmptyCompilation(refCode, references: new[] { corlibWithoutUnmanagedTypeRef }).EmitToImageReference(); 1152var ref2 = CreateEmptyCompilation(refCode, references: new[] { corlibWithoutUnmanagedTypeRef }).EmitToImageReference(); 1197var reference = CompileIL(ilSource, prependDefaultHeader: false); 1253var reference = CompileIL(ilSource, prependDefaultHeader: false); 1311var reference = CompileIL(ilSource, prependDefaultHeader: false); 1366var reference = CompileIL(ilSource, prependDefaultHeader: false); 1421var reference = CompileIL(ilSource, prependDefaultHeader: false);
PDB\PDBTests.cs (1)
38private static readonly MetadataReference[] s_valueTupleRefs = new[] { SystemRuntimeFacadeRef, ValueTupleRef };
PDB\PDBUsingTests.cs (18)
808var refA = comp.EmitToImageReference(aliases: ImmutableArray.Create("A2")); 858var refA1 = comp.EmitToImageReference(aliases: ImmutableArray.Create("A2")); 868var refA4 = comp.EmitToImageReference(aliases: ImmutableArray.Create("A5")); 944var refA1 = comp.EmitToImageReference(aliases: ImmutableArray.Create("A2")); 954var refA4 = comp.EmitToImageReference(aliases: ImmutableArray.Create("A5")); 1030var refA1 = comp.EmitToImageReference(aliases: ImmutableArray.Create("A2", "A3")); 1040var refA4 = comp.EmitToImageReference(aliases: ImmutableArray.Create("A5")); 1123var refA1 = comp.EmitToImageReference(aliases: ImmutableArray.Create("A2", "A3")); 1133var refA4 = comp.EmitToImageReference(aliases: ImmutableArray.Create("A5")); 1216var refA1 = comp.EmitToImageReference(aliases: ImmutableArray.Create("A2")); 1226var refA4 = comp.EmitToImageReference(aliases: ImmutableArray.Create("A5")); 1308var refA1 = comp.EmitToImageReference(aliases: ImmutableArray.Create("A2")); 1318var refA4 = comp.EmitToImageReference(aliases: ImmutableArray.Create("A5")); 2599var libRef = CreateCompilation(libSource, assemblyName: "Lib").EmitToImageReference(); 2694var libRef = lib.EmitToImageReference(aliases: ImmutableArray.Create("Q")); 3153var libRef = CreateCompilation(sourceLib, assemblyName: "ImportedNoPiaTypesAssemblyName").EmitToImageReference(embedInteropTypes: true); 3225var libRef1 = CreateCompilation(sourceLib1).EmitToImageReference(); 3226var libRef2 = CreateCompilation(sourceLib2, new[] { libRef1 }, assemblyName: "LibRef2").EmitToImageReference();
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (519)
Attributes\AttributeTests.cs (24)
1700var references = new[] { MetadataReference.CreateFromImage(TestResources.SymbolsTests.Metadata.MDTestAttributeDefLib.AsImmutableOrNull()) }; 3091var references = new[] { MetadataReference.CreateFromImage(TestResources.SymbolsTests.Metadata.AttributeTestDef01.AsImmutableOrNull()) }; 3165var references = new[] { MetadataReference.CreateFromImage(TestResources.SymbolsTests.Metadata.AttributeTestDef01) }; 3207var references = new[] { MetadataReference.CreateFromImage(TestResources.SymbolsTests.Metadata.AttributeTestDef01.AsImmutableOrNull()) }; 3441var references = new[] { MetadataReference.CreateFromImage(TestResources.SymbolsTests.Metadata.AttributeTestDef01.AsImmutableOrNull()) }; 3580var references = new[] { MetadataReference.CreateFromImage(TestResources.SymbolsTests.Metadata.AttributeTestDef01.AsImmutableOrNull()) }; 3674var references = new[] { MetadataReference.CreateFromImage(TestResources.SymbolsTests.Metadata.AttributeTestDef01.AsImmutableOrNull()) }; 3781var references = new[] { MetadataReference.CreateFromImage(TestResources.SymbolsTests.Metadata.AttributeTestDef01.AsImmutableOrNull()) }; 4885var ref1 = MetadataReference.CreateFromStream(metadataStream1); 4894var ref2 = MetadataReference.CreateFromStream(metadataStream2); 5707var r1 = c1.EmitToImageReference(); 5710var r2 = c2.EmitToImageReference(); 5991var references = new[] { MetadataReference.CreateFromImage(TestResources.SymbolsTests.Metadata.AttributeTestDef01.AsImmutableOrNull()) }; 8555var ref1 = comp.EmitToImageReference(); 8594var ref1 = comp.EmitToImageReference(); 8668var reference1 = CompileIL(source1, prependDefaultHeader: false); 8710var reference1 = CompileIL(source1, prependDefaultHeader: false); 8753var reference1 = CompileIL(source1, prependDefaultHeader: false); 8799var reference1 = CompileIL(source1, prependDefaultHeader: false); 8850var reference1 = CompileIL(source1, prependDefaultHeader: false); 10236var libRef = CreateCompilation(lib_cs, parseOptions: TestOptions.RegularPreview).EmitToImageReference(); 10286var libRef = CreateCompilation(lib_cs, parseOptions: TestOptions.RegularPreview).EmitToImageReference(); 10312var libRef = CreateCompilation(lib_cs, parseOptions: TestOptions.RegularPreview).EmitToImageReference(); 10338var libRef = CreateCompilation(lib_cs, parseOptions: TestOptions.RegularPreview).EmitToImageReference();
Attributes\AttributeTests_Assembly.cs (36)
412", new MetadataReference[] { deRef, neutralRef }, TestOptions.ReleaseDll, assemblyName: assemblyNameBase + "10"); 422compilation = CreateCompilationWithMscorlib40("", new MetadataReference[] { compilation.EmitToImageReference() }, TestOptions.ReleaseDll, assemblyName: assemblyNameBase + "20"); 444", new MetadataReference[] { en_usRef }, options: TestOptions.ReleaseDll, assemblyName: assemblyNameBase + "23"); 451compilation = CreateCompilationWithMscorlib40("", new MetadataReference[] { compilation.EmitToImageReference() }, TestOptions.ReleaseDll, assemblyName: assemblyNameBase + "25"); 463", new MetadataReference[] { deRef, neutralRef }, TestOptions.ReleaseDll, assemblyName: assemblyNameBase + "30"); 470compilation = CreateCompilationWithMscorlib40("", new MetadataReference[] { compilation.EmitToImageReference() }, TestOptions.ReleaseDll, assemblyName: assemblyNameBase + "40"); 495", new MetadataReference[] { deRef }, TestOptions.ReleaseDll, assemblyName: assemblyNameBase + "50"); 505compilation = CreateCompilationWithMscorlib40("", new MetadataReference[] { compilation.EmitToImageReference() }, TestOptions.ReleaseDll, assemblyName: assemblyNameBase + "60"); 1004private MetadataReference GetNetModuleWithAssemblyAttributesRef(string source = null, IEnumerable<MetadataReference> references = null) 1010private ModuleMetadata GetNetModuleWithAssemblyAttributes(string source = null, IEnumerable<MetadataReference> references = null, string assemblyName = null) 1418var netmodule1Ref = GetNetModuleWithAssemblyAttributesRef(); 1434var netmodule2Ref = compilation.EmitToImageReference(); 1521MetadataReference netmodule1Ref = GetNetModuleWithAssemblyAttributesRef(source2, references: new[] { defsRef }); 1532MetadataReference netmodule2Ref = GetNetModuleWithAssemblyAttributesRef(source1, references: new[] { defsRef }); 1569MetadataReference netmoduleRef = GetNetModuleWithAssemblyAttributesRef(s_defaultNetModuleSourceHeader + netmoduleAttributes + s_defaultNetModuleSourceBody); 1618MetadataReference netmoduleDefsRef = GetNetModuleWithAssemblyAttributesRef(defaultBodyString + s_defaultNetModuleSourceBody); 1619MetadataReference netmodule0Ref = GetNetModuleWithAssemblyAttributesRef(s_defaultNetModuleSourceHeader, references: new[] { netmoduleDefsRef }); 1620MetadataReference netmodule1Ref = GetNetModuleWithAssemblyAttributesRef(netmodule1Attributes, references: new[] { netmoduleDefsRef }); 1621MetadataReference netmodule2Ref = GetNetModuleWithAssemblyAttributesRef(netmodule2Attributes, references: new[] { netmoduleDefsRef }); 1622MetadataReference netmodule3Ref = GetNetModuleWithAssemblyAttributesRef(netmodule3Attributes, references: new[] { netmoduleDefsRef }); 1648MetadataReference netmoduleRef = GetNetModuleWithAssemblyAttributesRef(s_defaultNetModuleSourceHeader + netmoduleAttributes + s_defaultNetModuleSourceBody); 1690MetadataReference netmoduleRef = GetNetModuleWithAssemblyAttributesRef(s_defaultNetModuleSourceHeader + netmoduleAttributes + s_defaultNetModuleSourceBody); 1743var netModuleRef = GetNetModuleWithAssemblyAttributesRef(mod, new[] { Net40.References.SystemCore }); 1783var netModuleRef = GetNetModuleWithAssemblyAttributesRef(mod, new[] { SystemCoreRef }); 2120references: new MetadataReference[] { compMod1.EmitToImageReference(), compMod2.EmitToImageReference() }, 2152references: new MetadataReference[] { compMod1.EmitToImageReference(), compMod2.EmitToImageReference() }, 2182references: new MetadataReference[] { compMod1.EmitToImageReference(), compMod2.EmitToImageReference() }, 2214references: new MetadataReference[] { compMod1.EmitToImageReference(), compMod2.EmitToImageReference() }, 2239references: new MetadataReference[] { compMod1.EmitToImageReference() }, 2286var attributeDefinition1 = CreateCompilation(attribute1, options: TestOptions.ReleaseDll, assemblyName: "A1").EmitToImageReference(); 2291var moduleWithAttribute = CreateCompilation(module, references: new[] { attributeDefinition1 }, options: TestOptions.ReleaseModule, assemblyName: "M1").EmitToImageReference(); 2318var attributeDefinition2 = CreateCompilation(attribute2, options: TestOptions.ReleaseDll, assemblyName: "A1").EmitToImageReference(); 2337var c1Definition = CreateCompilation(c1, options: TestOptions.ReleaseDll, assemblyName: "A1").EmitToImageReference(); 2347var module1WithAttribute = CreateCompilation(module1, references: new[] { c1Definition }, options: TestOptions.ReleaseModule, assemblyName: "M1").EmitToImageReference(); 2376var module2WithAttribute = CreateCompilation(module2, references: new[] { c1Definition }, options: TestOptions.ReleaseModule, assemblyName: "M1").EmitToImageReference();
Attributes\AttributeTests_CallerInfoAttributes.cs (23)
22public static IEnumerable<MetadataReference> GetReferencesWithoutInteropServices() => 681var ref1 = comp1.EmitToImageReference(); 1567var ref1 = comp1.EmitToImageReference(); 2677var compilation = CreateCompilationWithMscorlib461(source, new MetadataReference[] { SystemRef }, TestOptions.ReleaseExe); 2711var compilation = CreateCompilationWithMscorlib461(source, new MetadataReference[] { SystemRef }, TestOptions.ReleaseExe); 2785CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { SystemRef }).VerifyDiagnostics( 3169MetadataReference libReference = CompileIL(iLSource); 3428var compilation = CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { SystemRef }, options: TestOptions.ReleaseExe); 3454var compilation = CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { SystemRef }); 3563var compilation = CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { SystemRef }, options: TestOptions.ReleaseExe); 3606var compilation = CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { SystemRef }, options: TestOptions.ReleaseExe); 4134var compilation = CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { SystemRef }, options: TestOptions.ReleaseExe); 4379var compilation = CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { SystemRef }, options: TestOptions.ReleaseExe); 4401var compilation = CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { SystemRef }, options: TestOptions.ReleaseExe); 4431var compilation = CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { SystemRef }, options: TestOptions.ReleaseExe); 4483MetadataReference libReference = CompileIL(iLSource); 4632MetadataReference libReference = CompileIL(iLSource); 5384var compilation = CreateCompilationWithMscorlib461(source, new MetadataReference[] { SystemRef }, TestOptions.ReleaseExe); 5420var compilation = CreateCompilationWithMscorlib461(source, new MetadataReference[] { SystemRef }, TestOptions.ReleaseExe); 5456var compilation = CreateCompilationWithMscorlib461(source, new MetadataReference[] { SystemRef }, TestOptions.ReleaseExe); 5495var compilation = CreateCompilationWithMscorlib461(source, new MetadataReference[] { SystemRef }, TestOptions.ReleaseExe); 5651var vbReference = BasicCompilationUtils.CompileToMetadata(vbSource, references: new[] { MscorlibRef_v4_0_30316_17626, SystemCoreRef }); 5741var vbReference = BasicCompilationUtils.CompileToMetadata(vbSource, references: new[] { MscorlibRef_v4_0_30316_17626, SystemCoreRef });
Attributes\AttributeTests_Dynamic.cs (2)
1191var ref0 = comp.EmitToImageReference(); 1228var ref0 = comp.EmitToImageReference();
Attributes\AttributeTests_Experimental.cs (1)
149var ref0 = CompileIL(source0);
Attributes\AttributeTests_IsUnmanaged.cs (8)
128var reference = CreateCompilation(@" 155var reference = CreateCompilation(@" 181var reference = CreateCompilation(@" 217var reference = CreateCompilation(@" 245var reference = CreateCompilation(@" 272var reference = CreateCompilation(@" 298var reference = CreateCompilation(@" 335var reference = CreateCompilation(@"
Attributes\AttributeTests_LifetimeAnnotation.cs (3)
56var ref0 = comp.EmitToImageReference(); 238var ref0 = CompileIL(source0, prependDefaultHeader: false); 310var ref0 = CompileIL(source0);
Attributes\AttributeTests_NativeInteger.cs (10)
63var ref0 = comp.EmitToImageReference(); 245var ref0 = CompileIL(source0); 330var ref0 = CompileIL(source0); 407var ref0 = CompileIL(source0); 490var ref0 = CompileIL(source0); 576var ref0 = CompileIL(source0); 693var ref0 = CompileIL(source0); 835var ref1 = comp.EmitToImageReference(); 845var ref2 = comp.EmitToImageReference(); 1386var ref1 = comp.EmitToImageReference();
Attributes\AttributeTests_Nullable.cs (22)
43Func<CSharpCompilation, MetadataReference> getReference = c => useImageReferences ? c.EmitToImageReference() : c.ToMetadataReference(); 108Func<CSharpCompilation, MetadataReference> getReference = c => useImageReferences ? c.EmitToImageReference() : c.ToMetadataReference(); 206Func<CSharpCompilation, MetadataReference> getReference = c => useImageReferences ? c.EmitToImageReference() : c.ToMetadataReference(); 372var ref0 = comp0.EmitToImageReference(); 529var refA = comp.EmitToImageReference(); 564var refA = comp.EmitToImageReference(); 598var ref0 = comp0.EmitToImageReference(); 646var ref0 = comp0.EmitToImageReference(); 699var ref0 = comp0.EmitToImageReference(); 2240var ref0 = comp0.EmitToImageReference(); 2493var ref0 = comp0.EmitToImageReference(); 4145var ref0 = comp.EmitToImageReference(); 4162var ref1 = comp.EmitToImageReference(); 4250var ref0 = comp.EmitToImageReference(); 4294var ref0 = comp.EmitToImageReference(); 4348var ref0 = comp.EmitToImageReference(); 4394var ref0 = comp0.EmitToImageReference(); 5207private static MetadataReference GetAnnotationUtilsLibrary() 5298var library = GetAnnotationUtilsLibrary(); 5316var library = GetAnnotationUtilsLibrary(); 5342var library = GetAnnotationUtilsLibrary(); 5366var library = GetAnnotationUtilsLibrary();
Attributes\AttributeTests_NullableContext.cs (4)
53var ref0 = comp.EmitToImageReference(); 168var ref0 = comp.EmitToImageReference(); 263var ref0 = comp0.EmitToImageReference(); 276var ref1 = comp1.EmitToImageReference();
Attributes\AttributeTests_NullablePublicOnly.cs (3)
54var ref1 = comp.EmitToImageReference(); 239var ref0 = comp.EmitToImageReference(); 464var ref0 = comp.EmitToImageReference();
Attributes\AttributeTests_RefReadOnly.cs (2)
1517var reference = CreateCompilation(@" 2222var reference = CreateCompilation(@"
Attributes\AttributeTests_RefSafetyRules.cs (5)
41var ref1 = AsReference(comp, useCompilationReference); 87var ref1 = AsReference(comp, useCompilationReference); 152var refA = CreateCompilation(sourceA, parseOptions: TestOptions.Regular10).EmitToImageReference(); 172var refA = AsReference(comp, useCompilationReference); 203var refA = CreateCompilation(sourceA).EmitToImageReference();
Attributes\AttributeTests_Synthesized.cs (7)
123var reference = CreateCompilation(source).EmitToImageReference(); 145var reference = CreateCompilation(source, options: TestOptions.UnsafeReleaseDll).EmitToImageReference(); 1800var reference = CreateCompilationWithMscorlib461(source, options: referenceOptions).EmitToImageReference(options: new EmitOptions(metadataOnly: true)); 1899var reference = CreateCompilationWithMscorlib461(source, options: referenceOptions).EmitToImageReference(options: new EmitOptions(metadataOnly: true)); 1935var mslibRef = mslibComp.EmitToImageReference(); 1939var mslibNoStringRef = mslibNoStringComp.EmitToImageReference(); 1956var diagLibRef = diagLibComp.EmitToImageReference();
Attributes\AttributeTests_Tuples.cs (3)
100private static readonly MetadataReference[] s_attributeRefs = 178var ref0 = comp.EmitToImageReference(); 216var ref0 = comp.EmitToImageReference();
Attributes\AttributeTests_WellKnownAttributes.cs (21)
576var libAssemblyRef = libComp.EmitToImageReference(); 761var ilReference = CompileIL(ilsource); 4188var assemblyRef = compDll.EmitToImageReference(expectedWarnings: new[] 6230var peReference = MetadataReference.CreateFromStream(CreateCompilation(peSource).EmitToStream()); 8604void verify(MetadataReference reference) 8659void verify(MetadataReference reference) 8703void verify(MetadataReference reference) 8746void verify(MetadataReference reference) 8846void verifyReference(MetadataReference reference, CSharpCompilationOptions options, DiagnosticDescription[] expectedDiagnostics) 8898void verify(MetadataReference reference) 8946void verify(MetadataReference reference) 9025void verify(MetadataReference reference) 9080void verify(MetadataReference reference) 9129void verify(MetadataReference reference) 9180void verify(MetadataReference reference) 9322var ilComp = CompileIL(ilSource); 9460var ilComp = CompileIL(ilSource); 9508void verify(MetadataReference reference) 10283var ilReference = CompileIL(ilsource); 10391var ilReference = CompileIL(ilsource); 13599var refA = comp.EmitToImageReference();
Attributes\InternalsVisibleToAndStrongNameTests.cs (19)
883new[] { MetadataReference.CreateFromStream(otherStream) }, 916new MetadataReference[] { new CSharpCompilationReference(other) }, 1070references: new[] { MetadataReference.CreateFromImage(other.EmitToArray()) }, 1194new MetadataReference[] { new CSharpCompilationReference(other) }, 1229new MetadataReference[] { new CSharpCompilationReference(other) }, 1269new MetadataReference[] { new CSharpCompilationReference(other) }, 1301new MetadataReference[] { new CSharpCompilationReference(other) }, 1337new MetadataReference[] { new CSharpCompilationReference(other) }, 1382new MetadataReference[] { new CSharpCompilationReference(giver) }, 1604var reference = other.EmitToImageReference(); 1628var reference = other.EmitToImageReference(); 2025var ilRef = CompileIL(il, prependDefaultHeader: false); 2375var ref2 = CompileIL(source2, prependDefaultHeader: false); 2417CompileAndVerify(other.WithReferences(new[] { other.References.ElementAt(0), MetadataReference.CreateFromStream(unsigned.EmitToStream()) })).VerifyDiagnostics(); 2444other.WithReferences(new []{other.References.ElementAt(0), MetadataReference.CreateFromStream(unsigned.EmitToStream()) })}; 2897var libRef = CreateCompilation(lib_cs, options: TestOptions.SigningReleaseDll, parseOptions: parseOptions).EmitToImageReference(); 2934var libRef = CreateCompilation(lib_cs, options: TestOptions.SigningReleaseDll).EmitToImageReference(); 3070MetadataReference imageReference = lib.EmitToImageReference(); 3194MetadataReference imageReference = lib.EmitToImageReference();
Diagnostics\DiagnosticAnalyzerTests.cs (3)
1536var compilation = CreateCompilationWithMscorlib461(trees, new MetadataReference[] { SystemRef }); 1571var compilation = CreateCompilationWithMscorlib461(new[] { tree }, new MetadataReference[] { SystemRef }); 1614var compilation = CreateCompilationWithMscorlib461(new[] { tree1, tree2 }, new MetadataReference[] { SystemRef });
FieldKeywordTests.cs (1)
8296var refA = comp.EmitToImageReference(
FirstClassSpanTests.cs (20)
1601var comp1 = CreateCompilation(source1).VerifyDiagnostics().EmitToImageReference(); 1993var spanDll = CreateCompilation(TestSources.Span, options: TestOptions.UnsafeReleaseDll) 2047var spanComp = CreateCompilation(getSpanSource("External"), assemblyName: "Span1") 2102var spanComp = CreateCompilation(getSpanSource("External"), assemblyName: "Span1") 2146var spanComp = CreateCompilation(getSpanSource("External"), assemblyName: "Span1") 2194var spanComp = CreateCompilation(getSpanSource("External"), assemblyName: "Span1") 2243var span1 = CreateCompilation(""" 2250var span2 = CreateCompilation(""" 2312var span1 = CreateCompilation(""" 2326var span2 = CreateCompilation(""" 2384var spanComp = CreateCompilation(getSpanSource("External"), assemblyName: "Span1") 2431var spanComp = CreateCompilation(getSpanSource("External"), assemblyName: "Span1") 2479var span1 = CreateCompilation(""" 2485var span2 = CreateCompilation(""" 2536var span1 = CreateCompilation(""" 2542var span2 = CreateCompilation(""" 2617var spanComp = CreateCompilation(getSpanSource("External"), assemblyName: "Span1") 2665var spanComp = CreateCompilation(getSpanSource("External"), assemblyName: "Span1") 2712var span1 = CreateCompilation(""" 2718var span2 = CreateCompilation($$"""
FlowAnalysis\FlowTestBase.cs (8)
87protected DataFlowAnalysis CompileAndAnalyzeDataFlowExpression(string program, params MetadataReference[] references) 92protected DataFlowAnalysis CompileAndAnalyzeDataFlowExpression(string program, TargetFramework targetFramework, params MetadataReference[] references) 97protected DataFlowAnalysis CompileAndAnalyzeDataFlowConstructorInitializer(string program, params MetadataReference[] references) 102protected DataFlowAnalysis CompileAndAnalyzeDataFlowPrimaryConstructorInitializer(string program, params MetadataReference[] references) 117protected T CompileAndGetModelAndConstructorInitializer<T>(string program, Func<SemanticModel, ConstructorInitializerSyntax, T> analysisDelegate, params MetadataReference[] references) 138protected T CompileAndGetModelAndPrimaryConstructorInitializer<T>(string program, Func<SemanticModel, PrimaryConstructorBaseTypeSyntax, T> analysisDelegate, params MetadataReference[] references) 159protected T CompileAndGetModelAndExpression<T>(string program, Func<SemanticModel, ExpressionSyntax, T> analysisDelegate, params MetadataReference[] references) 164protected T CompileAndGetModelAndExpression<T>(string program, Func<SemanticModel, ExpressionSyntax, T> analysisDelegate, TargetFramework targetFramework, bool assertNoDiagnostics, params MetadataReference[] references)
FlowAnalysis\RegionAnalysisTests.cs (1)
8047var libraryReference = CreateCompilation(libSource).EmitToImageReference();
FlowAnalysis\StructTests.cs (27)
545var metadataReference = MetadataReference.CreateFromStream(comp1.EmitToStream()); 561references: new MetadataReference[] { sourceReference }).VerifyDiagnostics( 571references: new MetadataReference[] { metadataReference }).VerifyDiagnostics( 581references: new MetadataReference[] { sourceReference }).VerifyDiagnostics( 588references: new MetadataReference[] { metadataReference }).VerifyDiagnostics( 605var metadataReference = MetadataReference.CreateFromStream(comp1.EmitToStream()); 616CreateCompilation(source2, references: new MetadataReference[] { sourceReference }).VerifyDiagnostics( 621CreateCompilation(source2, references: new MetadataReference[] { metadataReference }).VerifyDiagnostics( 638var metadataReference = MetadataReference.CreateFromStream(comp1.EmitToStream()); 649CreateCompilation(source2, references: new MetadataReference[] { sourceReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( 651CreateCompilation(source2, references: new MetadataReference[] { metadataReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( 653CreateCompilation(source2, references: new MetadataReference[] { sourceReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( 658CreateCompilation(source2, references: new MetadataReference[] { metadataReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( 683var metadataReference = MetadataReference.CreateFromStream(comp1.EmitToStream()); 694CreateCompilation(source2, references: new MetadataReference[] { sourceReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( 696CreateCompilation(source2, references: new MetadataReference[] { metadataReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( 698CreateCompilation(source2, references: new MetadataReference[] { sourceReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( 703CreateCompilation(source2, references: new MetadataReference[] { metadataReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( 727var moduleReference = comp1.EmitToImageReference(); 738CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( 743CreateCompilation(source2, references: new MetadataReference[] { moduleReference }).VerifyDiagnostics( 770var moduleReference = comp1.EmitToImageReference(); 781CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: WithNullableEnable()).VerifyDiagnostics( 786CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: WithNullableEnable().WithWarningLevel(5)).VerifyDiagnostics( 803var moduleReference = comp1.EmitToImageReference(); 814CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( 816CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics(
OverloadResolutionPriorityTests.cs (11)
258var derivedReference = useMetadataReference ? derivedComp.ToMetadataReference() : derivedComp.EmitToImageReference(); 307var derivedReference = useMetadataReference ? derivedComp.ToMetadataReference() : derivedComp.EmitToImageReference(); 466var assembly1 = comp1.EmitToImageReference(); 517var assembly2 = CompileIL(il2); 550var assembly1 = comp1.EmitToImageReference(); 646var assembly2 = CompileIL(il2); 1466var ilRef = CompileIL(il + OverloadResolutionPriorityAttributeILDefinition); 1789var vbRef = vb.EmitToImageReference(); 2209var ilRef = CompileIL(il + OverloadResolutionPriorityAttributeILDefinition); 2308var ilRef = CompileIL(il + OverloadResolutionPriorityAttributeILDefinition); 2478var ilRef = CompileIL(il + OverloadResolutionPriorityAttributeILDefinition);
RefReadonlyParameterTests.cs (13)
1305var comp1Ref = comp1.EmitToImageReference(); 1330var comp1bRef = comp1b.EmitToImageReference(); 1372var comp1v1Ref = comp1v1.EmitToImageReference(); 1387var comp2Ref = comp2.EmitToImageReference(); 1413var comp4Ref = comp4.EmitToImageReference(); 1419var comp1v2Ref = comp1v2.EmitToImageReference(); 1433var comp1v3Ref = comp1v3.EmitToImageReference(); 1440var comp1v4Ref = comp1v4.EmitToImageReference(); 1467var comp1Ref = comp1.EmitToImageReference(); 5251var comp1Ref = comp1.EmitToImageReference(); 6675var comp1v1Ref = emit ? comp1v1.EmitToImageReference() : comp1v1.ToMetadataReference(); 6684var comp1v2Ref = emit ? comp1v2.EmitToImageReference() : comp1v2.ToMetadataReference(); 6693var comp2Ref = emit ? comp2.EmitToImageReference() : comp2.ToMetadataReference();
RefStructInterfacesTests.cs (52)
645MetadataReference[] comp1Refs = [comp1.EmitToImageReference(), comp1.ToMetadataReference()]; 660foreach (var comp1Ref in comp1Refs) 684foreach (var comp1Ref in comp1Refs) 726foreach (var comp1Ref in comp1Refs) 752foreach (var comp1Ref in comp1Refs) 773foreach (var comp1Ref in comp1Refs) 799foreach (var comp1Ref in comp1Refs) 833foreach (var comp1Ref in comp1Refs) 862foreach (var comp1Ref in comp1Refs) 883foreach (var comp1Ref in comp1Refs) 906foreach (var comp1Ref in comp1Refs) 928foreach (var comp1Ref in comp1Refs) 949MetadataReference[] comp1Refs = [comp1.EmitToImageReference(), comp1.ToMetadataReference()]; 966foreach (var comp1Ref in comp1Refs) 993foreach (var comp1Ref in comp1Refs) 1063MetadataReference[] comp1Refs = [comp1.EmitToImageReference(), comp1.ToMetadataReference()]; 1084foreach (var comp1Ref in comp1Refs) 1141foreach (var comp1Ref in comp1Refs) 1214foreach (var comp1Ref in comp1Refs) 1253foreach (var comp1Ref in comp1Refs) 1302foreach (var comp1Ref in comp1Refs) 1339foreach (var comp1Ref in comp1Refs) 1392foreach (var comp1Ref in comp1Refs) 1449foreach (var comp1Ref in comp1Refs) 1469foreach (var comp1Ref in comp1Refs) 1494foreach (var comp1Ref in comp1Refs) 1516foreach (var comp1Ref in comp1Refs) 1544MetadataReference[] comp1Refs = [comp1.EmitToImageReference(), comp1.ToMetadataReference()]; 1566foreach (var comp1Ref in comp1Refs) 1600foreach (var comp1Ref in comp1Refs) 1639MetadataReference[] comp1Refs = [comp1.EmitToImageReference(), comp1.ToMetadataReference()]; 1660foreach (var comp1Ref in comp1Refs) 1717foreach (var comp1Ref in comp1Refs) 1790foreach (var comp1Ref in comp1Refs) 1829foreach (var comp1Ref in comp1Refs) 1878foreach (var comp1Ref in comp1Refs) 1915foreach (var comp1Ref in comp1Refs) 1968foreach (var comp1Ref in comp1Refs) 2025foreach (var comp1Ref in comp1Refs) 2045foreach (var comp1Ref in comp1Refs) 2070foreach (var comp1Ref in comp1Refs) 2092foreach (var comp1Ref in comp1Refs) 2120MetadataReference[] comp1Refs = [comp1.EmitToImageReference(), comp1.ToMetadataReference()]; 2142foreach (var comp1Ref in comp1Refs) 2176foreach (var comp1Ref in comp1Refs) 2722var refA = AsReference(comp, useCompilationReference); 2758var refA = AsReference(comp, useCompilationReference); 2797var refA = AsReference(comp, useCompilationReference); 2833var refA = AsReference(comp, useCompilationReference); 2867var refA = AsReference(comp, useCompilationReference); 2904var refA = AsReference(comp, useCompilationReference); 22397var refA = CompileIL(sourceA);
Semantics\CollectionExpressionTests.cs (77)
4689var refA = AsReference(comp, useCompilationReference); 9199var refA = comp.EmitToImageReference(); 9221var refB = comp.EmitToImageReference(); 12185var refA = comp.EmitToImageReference(); 12197var refB = comp.EmitToImageReference(); 13703var reference = CreateEmptyCompilation(runtime, assemblyName: "System.Runtime").VerifyDiagnostics().EmitToImageReference(); 15181var refA = AsReference(comp, useCompilationReference); 15372var refA = AsReference(comp, useCompilationReference); 15589var refA = comp.EmitToImageReference(); 15680var refA = AsReference(comp, useCompilationReference); 15768var refA = AsReference(comp, useCompilationReference); 15817var refA = AsReference(comp, useCompilationReference); 15866var refA = AsReference(comp, useCompilationReference); 15915var refA = AsReference(comp, useCompilationReference); 15955var refA = AsReference(comp, useCompilationReference); 16017var refA = AsReference(comp, useCompilationReference); 16082var refA = AsReference(comp, useCompilationReference); 16131var refA = AsReference(comp, useCompilationReference); 16173var refA = AsReference(comp, useCompilationReference); 16227var refA = AsReference(comp, useCompilationReference); 16346var refA = AsReference(comp, useCompilationReference); 16378var refA = comp.EmitToImageReference(); 16392var refB = comp.EmitToImageReference(); 16435var refA = AsReference(comp, useCompilationReference); 16483var refA = CompileIL(sourceA); 16562var refA = CompileIL(sourceA); 16655var refA = CompileIL(sourceA); 16871var refA = CompileIL(sourceA); 16916var refA = AsReference(comp, useCompilationReference); 16965var refA = AsReference(comp, useCompilationReference); 17019var refA = AsReference(comp, useCompilationReference); 17086var refA = AsReference(comp, useCompilationReference); 17151var refA = AsReference(comp, useCompilationReference); 17340var refA = AsReference(comp, useCompilationReference); 17389var refA = AsReference(comp, useCompilationReference); 17438var refA = AsReference(comp, useCompilationReference); 17484var refA = AsReference(comp, useCompilationReference); 17530var refA = AsReference(comp, useCompilationReference); 17573var refA = AsReference(comp, useCompilationReference); 17621var refA = AsReference(comp, useCompilationReference); 17666var refA = AsReference(comp, useCompilationReference); 17712var refA = AsReference(comp, useCompilationReference); 17815var refA = AsReference(comp, useCompilationReference); 17867var refA = AsReference(comp, useCompilationReference); 17927var refA = AsReference(comp, useCompilationReference); 17972var refA = AsReference(comp, useCompilationReference); 18017var refA = AsReference(comp, useCompilationReference); 18075var refA = AsReference(comp, useCompilationReference); 18119var refA = AsReference(comp, useCompilationReference); 18852var refA = AsReference(comp, useCompilationReference); 18943var refA = AsReference(comp, useCompilationReference); 18989var refA = AsReference(comp, useCompilationReference); 19086var refA = AsReference(comp, useCompilationReference); 19149var refA = AsReference(comp, useCompilationReference); 19253var refA = AsReference(comp, useCompilationReference); 19522var refA = AsReference(comp, useCompilationReference); 19606var refA = AsReference(comp, useCompilationReference); 19698var refA = AsReference(comp, useCompilationReference); 19761var refA = CompileIL(sourceA); 19818var refA = CompileIL(sourceA); 19858var refA = comp.EmitToImageReference(); 19873var refB = comp.EmitToImageReference(); 22562var refA = comp.EmitToImageReference(); 22701var refA = AsReference(comp, useCompilationReference); 25651var refA = comp.EmitToImageReference(); 38821var refA1 = comp.EmitToImageReference(); 38835var refB = comp.EmitToImageReference(); 38844var refA2 = comp.EmitToImageReference(); 40072var refA = comp.EmitToImageReference(); 40610var refA = comp.EmitToImageReference(); 41900var refA = comp.EmitToImageReference(); 41914var refB = comp.EmitToImageReference(); 41961var refA = comp.EmitToImageReference(); 41975var refB = comp.EmitToImageReference(); 42707var comp1Ref = comp1.EmitToImageReference(); 42787var comp1Ref = comp1.EmitToImageReference(); 42870var myCollectionRef = myCollection.EmitToImageReference();
Semantics\ExperimentalAttributeTests.cs (23)
130var attrRef = attrComp.EmitToImageReference(); 155var attrRef = attrComp.EmitToImageReference(); 195var attrRef = attrComp.EmitToImageReference(); 231var attrRef = attrComp.EmitToImageReference(); 237var moduleRef = moduleComp.EmitToImageReference(); 261var attrRef = attrComp.EmitToImageReference(); 267var moduleRef = moduleComp.EmitToImageReference(); 387var attrRef = attrComp.EmitToImageReference(); 412var attrRef = attrComp.EmitToImageReference(); 452var attrRef = attrComp.EmitToImageReference(); 480var attrRef = attrComp.EmitToImageReference(); 522var attrRef = attrComp.EmitToImageReference(); 535var moduleRef = moduleComp.EmitToImageReference(); 548var assemblyRef = assemblyComp.EmitToImageReference(); 571var attrRef = attrComp.EmitToImageReference(); 604var attrRef = attrComp.EmitToImageReference(); 644var attrRef = attrComp.EmitToImageReference(); 672var attrRef = attrComp.EmitToImageReference(); 888var missingRef = CreateCompilation("public class Base { }", assemblyName: "missing").EmitToImageReference(); 918var attrRef = CreateCompilation(experimentalAttributeSrc).EmitToImageReference(); 955var attrRef = CreateCompilation(experimentalAttributeSrc).EmitToImageReference(); 983var attrRef = CreateCompilation(experimentalAttributeSrc).EmitToImageReference(); 1020var attrRef = CreateCompilation(experimentalAttributeSrc).EmitToImageReference();
Semantics\LockTests.cs (3)
1511var lib = CreateCompilation(LockTypeDefinition) 1554var lib1 = CreateCompilation(source1) 1585var lib2 = CreateCompilation(source2)
Semantics\OutVarTests.cs (4)
1708references: new MetadataReference[] { CSharpRef }, 19281references: new MetadataReference[] { CSharpRef }, 20334var reference1 = CompileIL(source1); 20520var reference1 = CompileIL(source1);
Semantics\ParamsCollectionTests.cs (21)
1039var myCollectionRef = myCollection.EmitToImageReference(); 4021void verify(MetadataReference comp1Ref) 4088void verify(MetadataReference comp1Ref) 4203void verify(MetadataReference comp1Ref) 4327void verify(MetadataReference comp1Ref) 4403void verify(MetadataReference comp1Ref) 6347var comp1Ref = CreateCompilation(src1).EmitToImageReference(); 6397var comp1Ref = CreateCompilation(src1).EmitToImageReference(); 6562var comp0Ref = CreateCompilation(src0).EmitToImageReference(); 6640var comp0Ref = CreateCompilation(src0).EmitToImageReference(); 6887MetadataReference comp1Ref = comp1.EmitToImageReference(); 7257var comp1Ref = CreateCompilation(src1).EmitToImageReference(); 7381var comp1Ref = CreateCompilation(src1).EmitToImageReference(); 7434var comp1Ref = CreateCompilation(src1).EmitToImageReference(); 7789MetadataReference comp1Ref = comp1.EmitToImageReference(); 7980var comp1Ref = CreateCompilation(src1).EmitToImageReference(); 8066var comp1Ref = CreateCompilation(src1).EmitToImageReference(); 12758IEnumerable<MetadataReference> references = src2 is null ? [] : [CreateCompilation(src2).ToMetadataReference()]; 13244var comp1Ref = comp1.EmitToImageReference(); 13508var comp1Ref = comp1.EmitToImageReference(); 13609var comp1Ref = comp1.EmitToImageReference();
Semantics\PatternMatchingTests.cs (5)
5777var compilation = CreateCompilation(source, references: new MetadataReference[] { CSharpRef }, options: TestOptions.ReleaseExe); 8558var refA = comp.EmitToImageReference(); 10162var refA = comp.EmitToImageReference(); 10967var refA = comp.EmitToImageReference(); 11325var refA = comp.EmitToImageReference();
Semantics\PatternMatchingTests_ListPatterns.cs (7)
3256var missingRef = CreateCompilation(missing_cs, assemblyName: "missing") 3267var lib2Ref = CreateCompilation(lib2_cs, references: new[] { missingRef }) 3351var missingRef = CreateCompilation(missing_cs, assemblyName: "missing") 3365var lib2Ref = CreateCompilation(new[] { lib2_cs, TestSources.Index, TestSources.Range }, references: new[] { missingRef }) 3433var rangeRef = rangeComp.EmitToImageReference(); 5347var missingRef = CreateCompilation(missing_cs, assemblyName: "missing") 5359var lib2Ref = CreateCompilation(new[] { lib2_cs, TestSources.Index, TestSources.Range }, references: new[] { missingRef })
Semantics\PatternMatchingTests4.cs (2)
3068var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 3098var reference1 = BasicCompilationUtils.CompileToMetadata(source1);
Semantics\PatternMatchingTests5.cs (8)
2073var ref1 = CreateCompilation(INumberBaseDefinition, assemblyName: "A").EmitToImageReference(); 2074var ref2 = CreateCompilation(INumberBaseDefinition, assemblyName: "B").EmitToImageReference(); 2120var ref1 = CreateCompilation(INumberBaseDefinition, assemblyName: "A").EmitToImageReference(aliases: ImmutableArray.Create("A")); 2121var ref2 = CreateCompilation(INumberBaseDefinition, assemblyName: "B").EmitToImageReference(); 2234var ref1 = CreateCompilation(INumberBaseDefinition, assemblyName: "A").EmitToImageReference(); 2235var ref2 = CreateCompilation(INumberBaseDefinition, assemblyName: "B").EmitToImageReference(); 2298var ref1 = CreateCompilation(INumberBaseDefinition).EmitToImageReference(aliases: ImmutableArray.Create("A")); 2299var ref2 = CreateCompilation(INumberBaseDefinition).EmitToImageReference();
Semantics\RecordTests.cs (40)
30IEnumerable<MetadataReference>? references = null) 4205var comp1Ref = CreateCompilation(source1).EmitToImageReference(); 4211var comp2Ref = CreateCompilation(new[] { source2, IsExternalInitTypeDefinition }, references: new[] { comp1Ref }, parseOptions: TestOptions.Regular9).EmitToImageReference(); 4236var comp1Ref = CreateCompilation(new[] { source1, IsExternalInitTypeDefinition }, assemblyName: "Clone_12", parseOptions: TestOptions.Regular9).EmitToImageReference(); 4242var comp2Ref = CreateCompilation(new[] { source2, IsExternalInitTypeDefinition }, references: new[] { comp1Ref }, parseOptions: TestOptions.Regular9).EmitToImageReference(); 4271var comp1Ref = CreateCompilation(new[] { source1, IsExternalInitTypeDefinition }, parseOptions: TestOptions.Regular9).EmitToImageReference(); 4277var comp2Ref = CreateCompilation(new[] { source2, IsExternalInitTypeDefinition }, assemblyName: "Clone_13", references: new[] { comp1Ref }, parseOptions: TestOptions.Regular9).EmitToImageReference(); 4283var comp3Ref = CreateCompilation(new[] { source3, IsExternalInitTypeDefinition }, references: new[] { comp1Ref, comp2Ref }, parseOptions: TestOptions.Regular9).EmitToImageReference(); 4335var comp1Ref = CreateCompilation(source1).EmitToImageReference(); 4341var comp2Ref = CreateCompilation(new[] { source2, IsExternalInitTypeDefinition }, references: new[] { comp1Ref }, parseOptions: TestOptions.Regular9).EmitToImageReference(); 4366var comp1Ref = CreateCompilation(new[] { source1, IsExternalInitTypeDefinition }, assemblyName: "Clone_15", parseOptions: TestOptions.Regular9).EmitToImageReference(); 4372var comp2Ref = CreateCompilation(new[] { source2, IsExternalInitTypeDefinition }, references: new[] { comp1Ref }, parseOptions: TestOptions.Regular9).EmitToImageReference(); 4428var comp1Ref = CreateCompilation(new[] { source1, IsExternalInitTypeDefinition }, parseOptions: TestOptions.Regular9).EmitToImageReference(); 4434var comp2Ref = CreateCompilation(new[] { source2, IsExternalInitTypeDefinition }, assemblyName: "Clone_16", references: new[] { comp1Ref }, parseOptions: TestOptions.Regular9).EmitToImageReference(); 4440var comp3Ref = CreateCompilation(new[] { source3, IsExternalInitTypeDefinition }, references: new[] { comp1Ref, comp2Ref }, parseOptions: TestOptions.Regular9).EmitToImageReference(); 9801var refA = useCompilationReference ? comp.ToMetadataReference() : comp.EmitToImageReference(); 10571var refA = useCompilationReference ? comp.ToMetadataReference() : comp.EmitToImageReference(); 10825var refA = comp.EmitToImageReference(); 10873var refA = comp.EmitToImageReference(); 10951var refA = compA.EmitToImageReference(); 11023var refA = compA.EmitToImageReference(); 11113var refA = compA.EmitToImageReference(); 12190var refA = CompileIL(sourceA); 12265var refA = CompileIL(sourceA); 12344var refA = CompileIL(sourceA); 12449var refA = CompileIL(sourceA); 12572var refA = CompileIL(sourceA); 12615var refA = useCompilationReference ? compA.ToMetadataReference() : compA.EmitToImageReference(); 13341var refA = compA.EmitToImageReference(); 16283var ref0 = comp.EmitToImageReference(); 17232var ref0 = comp.EmitToImageReference(); 17328var ref0 = comp.EmitToImageReference(); 17424var ref0 = comp.EmitToImageReference(); 23800var refA = useCompilationReference ? comp.ToMetadataReference() : comp.EmitToImageReference(); 24276var ref0 = comp.EmitToImageReference(); 24341var ref0 = comp.EmitToImageReference(); 24411var ref0 = comp.EmitToImageReference(); 24490var ref0 = comp.EmitToImageReference(); 26086var compRef = CreateCompilation(src).EmitToImageReference(); 30188var refA = useCompilationReference ? compA.ToMetadataReference() : compA.EmitToImageReference();
Microsoft.CodeAnalysis.CSharp.Features (3)
AddImport\CSharpAddImportFeatureService.cs (1)
558var metadataReference = semanticModel.Compilation.GetMetadataReference(namespaceSymbol.ContainingAssembly);
DecompiledSource\CSharpDecompiledSourceService.cs (1)
31public async Task<Document?> AddSourceToAsync(Document document, Compilation symbolCompilation, ISymbol symbol, MetadataReference? metadataReference, string? assemblyLocation, SyntaxFormattingOptions? formattingOptions, CancellationToken cancellationToken)
SemanticSearch\CSharpSemanticSearchService.cs (1)
25IEnumerable<MetadataReference> references,
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (2)
EditAndContinue\StatementEditingTests.cs (2)
3721MetadataReference delegateDefs; 3724delegateDefs = MetadataReference.CreateFromImage(File.ReadAllBytes(tempAssembly.Path));
Microsoft.CodeAnalysis.CSharp.IOperation.UnitTests (9)
IOperation\IOperationTests_IArgument.cs (3)
2091var ilReference = VerifyOperationTreeAndDiagnosticsForTestWithIL<ElementAccessExpressionSyntax>(csharp, il, expectedOperationTree, expectedDiagnostics, additionalOperationTreeVerifier: IndexerAccessArgumentVerifier.Verify); 2210var ilReference = VerifyOperationTreeAndDiagnosticsForTestWithIL<ElementAccessExpressionSyntax>(csharp, il, expectedOperationTree, expectedDiagnostics, additionalOperationTreeVerifier: IndexerAccessArgumentVerifier.Verify); 2330var ilReference = VerifyOperationTreeAndDiagnosticsForTestWithIL<ElementAccessExpressionSyntax>(csharp, il, expectedOperationTree, expectedDiagnostics, additionalOperationTreeVerifier: IndexerAccessArgumentVerifier.Verify);
IOperation\IOperationTests_IObjectCreationExpression.cs (1)
15270var reference1 = BasicCompilationUtils.CompileToMetadata(source1, verify: Verification.Passes);
IOperation\IOperationTests_IUsingStatement.cs (5)
1756var ilReference = CreateMetadataReferenceFromIlSource(ilSource); 1938var ilReference = CreateMetadataReferenceFromIlSource(ilSource); 2072var ilReference = CreateMetadataReferenceFromIlSource(ilSource); 2206var ilReference = CreateMetadataReferenceFromIlSource(ilSource); 2341var ilReference = CreateMetadataReferenceFromIlSource(ilSource);
Microsoft.CodeAnalysis.CSharp.Scripting.Desktop.UnitTests (18)
InteractiveSessionReferencesTests.cs (17)
463var badTypeRef = MetadataReference.CreateFromImage(badTypeBytes.AsImmutableOrNull()); 610", new MetadataReference[] { NetFramework.mscorlib, libBase.ToMetadataReference() }, lib1Name); 617", new MetadataReference[] { NetFramework.mscorlib, libBase.ToMetadataReference() }, lib2Name); 668", new MetadataReference[] { NetFramework.mscorlib, libBase.ToMetadataReference() }, lib1Name); 675", new MetadataReference[] { NetFramework.mscorlib, libBase.ToMetadataReference() }, lib2Name); 733", new MetadataReference[] { NetFramework.mscorlib, libBase1.ToMetadataReference() }, lib1Name); 740", new MetadataReference[] { NetFramework.mscorlib, libBase1.ToMetadataReference() }, lib2Name); 801", new MetadataReference[] { NetFramework.mscorlib, libBase1.ToMetadataReference() }, lib1Name); 808", new MetadataReference[] { NetFramework.mscorlib, libBase1.ToMetadataReference() }, lib2Name); 869", new MetadataReference[] { NetFramework.mscorlib, libBase1.ToMetadataReference() }, lib1Name); 876", new MetadataReference[] { NetFramework.mscorlib, libBase1.ToMetadataReference() }, lib2Name); 937", new MetadataReference[] { NetFramework.mscorlib, libBase1.ToMetadataReference() }, lib1Name); 944", new MetadataReference[] { NetFramework.mscorlib, libBase1.ToMetadataReference() }, lib2Name); 1005", new MetadataReference[] { NetFramework.mscorlib, libBase1.ToMetadataReference() }, lib1Name); 1012", new MetadataReference[] { NetFramework.mscorlib, libBase2.ToMetadataReference() }, lib2Name); 1073", new MetadataReference[] { NetFramework.mscorlib, libBase1.ToMetadataReference() }, lib1Name); 1080", new MetadataReference[] { NetFramework.mscorlib, libBase2.ToMetadataReference() }, lib2Name);
ObjectFormatterTests.cs (1)
93var reference = MetadataReference.CreateFromAssemblyInternal(typeof(object).GetTypeInfo().Assembly);
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (8)
CommandLineRunnerTests.cs (2)
812", new MetadataReference[] { NetFramework.mscorlib, libBase1.ToMetadataReference() }, lib1Name); 819", new MetadataReference[] { NetFramework.mscorlib, libBase1.ToMetadataReference() }, lib2Name);
InteractiveSessionReferencesTests.cs (2)
88var libDRef = MetadataReference.CreateFromFile(libDFile.Path); 133var libBRef = MetadataReference.CreateFromFile(libBFile.Path);
InteractiveSessionTests.cs (4)
1219}", new MetadataReference[] { NetStandard13.References.SystemRuntime, lib1.ToMetadataReference() }); 1281new MetadataReference[] { NetStandard13.References.SystemRuntime, libExe.ToMetadataReference() }, 1311new MetadataReference[] { NetStandard13.References.SystemRuntime, libExe.ToMetadataReference() }, 1339var libRef = CreateCSharpCompilationWithCorlib(source, "lib").EmitToImageReference();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (572)
Semantics\AccessCheckTests.cs (15)
630}", new List<MetadataReference>() { new CSharpCompilationReference(other) }); 994}", new MetadataReference[] { new CSharpCompilationReference(other) }, assemblyName: "AccessCheckCrossAssemblyParameterProtectedMethod2"); 1014}", new MetadataReference[] { new CSharpCompilationReference(other) }, assemblyName: "AccessCheckCrossAssemblyParameterProtectedMethod2"); 1037}", new MetadataReference[] { MetadataReference.CreateFromImage(other) }, assemblyName: "AccessCheckCrossAssemblyParameterProtectedMethod2"); 1088var reference1 = MetadataReference.CreateFromImage(compilationVerifier.EmittedAssemblyData); 1114var reference2 = MetadataReference.CreateFromImage(compilationVerifier.EmittedAssemblyData); 1161var reference1 = MetadataReference.CreateFromImage(compilationVerifier.EmittedAssemblyData); 1172var reference2 = MetadataReference.CreateFromImage(compilationVerifier.EmittedAssemblyData); 1198var referenceA = MetadataReference.CreateFromImage(compilationVerifier.EmittedAssemblyData); 1210var referenceB = MetadataReference.CreateFromImage(compilationVerifier.EmittedAssemblyData); 1240var referenceA = MetadataReference.CreateFromImage(compilationVerifier.EmittedAssemblyData); 1251var referenceB = MetadataReference.CreateFromImage(compilationVerifier.EmittedAssemblyData); 1446var refA = comp.EmitToImageReference(); 1479var refA = comp.EmitToImageReference();
Semantics\AccessibilityTests.cs (1)
69references: new MetadataReference[] { MscorlibRef }).GetWellKnownType(WellKnownType.System_Exception);
Semantics\AmbiguousOverrideTests.cs (4)
132var ref1 = new List<MetadataReference>() { comp1ref }; 137var ref2 = new List<MetadataReference>() { comp1ref, comp2ref }; 445var asm = MetadataReference.CreateFromImage(TestResources.SymbolsTests.CustomModifiers.ModoptTests.AsImmutableOrNull()); 1357var reference = CompileIL(il, prependDefaultHeader: true);
Semantics\AwaitExpressionTests.cs (1)
155var comp = CreateCompilationWithMscorlib461(new SyntaxTree[] { tree }, new MetadataReference[] { SystemRef });
Semantics\BetterCandidates.cs (3)
26private CSharpCompilation CreateCompilationWithoutBetterCandidates(string source, CSharpCompilationOptions options = null, MetadataReference[] references = null) 30private CSharpCompilation CreateCompilationWithBetterCandidates(string source, CSharpCompilationOptions options = null, MetadataReference[] references = null) 986var reference1 = BasicCompilationUtils.CompileToMetadata(source1, verify: Verification.Passes);
Semantics\BindingAsyncTasklikeMoreTests.cs (6)
649var compilation = CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { CSharpRef, SystemCoreRef }); 1168var ref0 = compilation0.EmitToImageReference(); 1260var ref0 = compilation0.EmitToImageReference(); 1331var ref0 = compilation0.EmitToImageReference(); 1405var ref0 = compilation0.EmitToImageReference(); 1479var ref0 = compilation0.EmitToImageReference();
Semantics\BindingAsyncTests.cs (21)
412CreateCompilationWithMscorlib461(source, new MetadataReference[] { LinqAssemblyRef, SystemRef }).VerifyDiagnostics( 449CreateCompilationWithMscorlib461(source, new MetadataReference[] { LinqAssemblyRef, SystemRef }).VerifyDiagnostics(); 479CreateCompilationWithMscorlib461(source, new MetadataReference[] { LinqAssemblyRef, SystemRef }).VerifyDiagnostics( 512CreateCompilationWithMscorlib461(source, new MetadataReference[] { LinqAssemblyRef, SystemRef }).VerifyDiagnostics( 546CreateCompilationWithMscorlib461(source, new MetadataReference[] { LinqAssemblyRef, SystemRef }).VerifyDiagnostics( 580CreateCompilationWithMscorlib461(source, new MetadataReference[] { LinqAssemblyRef, SystemRef }).VerifyDiagnostics( 1342CreateCompilationWithMscorlib461(source, new MetadataReference[] { SystemRef, LinqAssemblyRef }).VerifyDiagnostics(); 1371CreateCompilationWithMscorlib461(source, new MetadataReference[] { SystemRef, LinqAssemblyRef }).VerifyDiagnostics(); 1399CreateCompilationWithMscorlib461(source, new MetadataReference[] { SystemRef, LinqAssemblyRef }).VerifyDiagnostics( 1431CreateCompilationWithMscorlib461(source, new MetadataReference[] { SystemRef, LinqAssemblyRef }).VerifyDiagnostics( 1466CreateCompilationWithMscorlib461(source, new MetadataReference[] { SystemRef, LinqAssemblyRef }).VerifyDiagnostics( 1504new MetadataReference[] { SystemRef, LinqAssemblyRef }, 1545new MetadataReference[] { SystemRef, LinqAssemblyRef }, 1577CreateCompilationWithMscorlib461(source, new MetadataReference[] { SystemRef, LinqAssemblyRef }).VerifyDiagnostics( 1742CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { CSharpRef, SystemCoreRef }).VerifyDiagnostics( 1902CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { CSharpRef, SystemCoreRef }).VerifyDiagnostics( 1957CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { CSharpRef, SystemCoreRef }).VerifyDiagnostics( 2343CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { CSharpRef, SystemCoreRef }).VerifyDiagnostics( 2532CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { CSharpRef, SystemCoreRef }).VerifyDiagnostics( 2890CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { CSharpRef, SystemCoreRef }).VerifyDiagnostics( 3947var reference = CompileIL(ilSource);
Semantics\BindingTests.cs (22)
778", assemblyName: "DerivedAssembly1", references: new List<MetadataReference>() { baseAssembly.EmitToImageReference() }).VerifyDiagnostics(); 791", references: new List<MetadataReference>() { derivedAssembly.EmitToImageReference() }) 817", assemblyName: "DerivedAssembly2", references: new List<MetadataReference>() { baseAssembly.EmitToImageReference() }).VerifyDiagnostics(); 830", references: new List<MetadataReference>() { derivedAssembly.EmitToImageReference() }) 856", assemblyName: "DerivedAssembly3", references: new List<MetadataReference>() { baseAssembly.EmitToImageReference() }).VerifyDiagnostics(); 867}", references: new List<MetadataReference>() { derivedAssembly.EmitToImageReference() }) 1465}", references: new List<MetadataReference>() { TestReferences.SymbolsTests.NoPia.NoPIAGenericsAsm1 }) 1497}", references: new List<MetadataReference>() { TestReferences.SymbolsTests.NoPia.NoPIAGenericsAsm1 }) 1522}", references: new List<MetadataReference>() { TestReferences.SymbolsTests.NoPia.NoPIAGenericsAsm1 }) 1558}", references: new List<MetadataReference>() { TestReferences.SymbolsTests.NoPia.NoPIAGenericsAsm1 }) 1595CSharpCompilation comp2 = CreateCompilationWithMscorlib461(source2, new MetadataReference[] { new CSharpCompilationReference(comp1, embedInteropTypes: true) }, assemblyName: "Bar948674_1"); 1606CSharpCompilation comp3 = CreateCompilationWithMscorlib461(source3, new MetadataReference[] { new CSharpCompilationReference(comp2), new CSharpCompilationReference(comp1, embedInteropTypes: true) }); 1614comp3 = CreateCompilationWithMscorlib461(source3, new MetadataReference[] { comp2.EmitToImageReference(), comp1.EmitToImageReference().WithEmbedInteropTypes(true) }); 1648CSharpCompilation comp2 = CreateCompilationWithMscorlib461(source2, new MetadataReference[] { new CSharpCompilationReference(comp1, embedInteropTypes: true) }, assemblyName: "Bar948674_2"); 1659CSharpCompilation comp3 = CreateCompilationWithMscorlib461(source3, new MetadataReference[] { new CSharpCompilationReference(comp2), new CSharpCompilationReference(comp1, embedInteropTypes: true) }); 1670comp3 = CreateCompilationWithMscorlib461(source3, new MetadataReference[] { comp2.EmitToImageReference(), comp1.EmitToImageReference().WithEmbedInteropTypes(true) }); 1704CSharpCompilation comp2 = CreateCompilationWithMscorlib461(source2, new MetadataReference[] { new CSharpCompilationReference(comp1, embedInteropTypes: true) }, assemblyName: "Bar948674_3"); 1713CSharpCompilation comp3 = CreateCompilationWithMscorlib461(source3, new MetadataReference[] { new CSharpCompilationReference(comp2), new CSharpCompilationReference(comp1, embedInteropTypes: true) }); 1721comp3 = CreateCompilationWithMscorlib461(source3, new MetadataReference[] { comp2.EmitToImageReference(), comp1.EmitToImageReference().WithEmbedInteropTypes(true) }); 1752CSharpCompilation comp2 = CreateCompilationWithMscorlib461(source2, new MetadataReference[] { new CSharpCompilationReference(comp1, embedInteropTypes: true) }, assemblyName: "Bar948674_4"); 1761CSharpCompilation comp3 = CreateCompilationWithMscorlib461(source3, new MetadataReference[] { new CSharpCompilationReference(comp2), new CSharpCompilationReference(comp1, embedInteropTypes: true) }); 1772comp3 = CreateCompilationWithMscorlib461(source3, new MetadataReference[] { comp2.EmitToImageReference(), comp1.EmitToImageReference().WithEmbedInteropTypes(true) });
Semantics\ColorColorTests.cs (6)
1581var ref1 = MetadataReference.CreateFromStream(comp1.EmitToStream()); 1622var ref1 = MetadataReference.CreateFromStream(comp1.EmitToStream()); 1660var ref1 = MetadataReference.CreateFromStream(comp1.EmitToStream()); 1701var ref1 = MetadataReference.CreateFromStream(comp1.EmitToStream()); 2103references: new MetadataReference[] 2146references: new MetadataReference[]
Semantics\ConstantTests.cs (3)
2845var compilation2 = CreateCompilation(source2, new MetadataReference[] { new CSharpCompilationReference(compilation1) }); 2889var compilation3 = CreateCompilation(source3, new MetadataReference[] { reference1 }); 2891var compilation4 = CreateCompilation(source4, new MetadataReference[] { reference2, reference3 });
Semantics\DeconstructionTests.cs (3)
21private static readonly MetadataReference[] s_valueTupleRefs = new[] { SystemRuntimeFacadeRef, ValueTupleRef }; 1604var libMissingRef = libMissingComp.EmitToImageReference(); 1607var libRef = libComp.EmitToImageReference();
Semantics\DelegateTypeTests.cs (27)
3901var refA = CompileIL(sourceA); 3935var refA = CompileIL(sourceA); 4064var refA = CompileIL(sourceA, prependDefaultHeader: false, autoInherit: false); 4093private static MetadataReference GetCorlibWithInvalidActionAndFuncOfT() 4162var refA = GetCorlibWithInvalidActionAndFuncOfT(); 4241var refA = CompileIL(sourceA, prependDefaultHeader: false, autoInherit: false); 4332var refA = CompileIL(sourceA, prependDefaultHeader: false, autoInherit: false); 4351private static MetadataReference GetCorlibWithExpressionOfTNotDerivedType() 4417var refA = GetCorlibWithExpressionOfTNotDerivedType(); 4438var refA = GetCorlibWithExpressionOfTNotDerivedType(); 12632var refA = CompileIL(sourceA); 13564var comp1aRef = comp1a.EmitToImageReference(); 13573var comp2Ref = comp2.EmitToImageReference(); 13681var comp1aRef = comp1a.EmitToImageReference(); 13691var comp2Ref = comp2.EmitToImageReference(); 13700var comp1bRef = comp1b.EmitToImageReference(); 13814var comp1aRef = comp1a.EmitToImageReference(); 13824var comp2Ref = comp2.EmitToImageReference(); 13833var comp1bRef = comp1b.EmitToImageReference(); 13930var comp1aRef = comp1a.EmitToImageReference(); 13939var comp2Ref = comp2.EmitToImageReference(); 13975var comp1bRef = comp1b.EmitToImageReference(); 14227var refAttribute = comp.EmitToImageReference(); 14238var refA = comp.EmitToImageReference(); 14302var refA = comp.EmitToImageReference(); 17367var ref1 = comp1.EmitToImageReference(embedInteropTypes: true); 17390var ref1 = comp1.EmitToImageReference(embedInteropTypes: true);
Semantics\DynamicTests.cs (7)
4019var reference = BasicCompilationUtils.CompileToMetadata(source1); 4254MetadataReference reference = CompileIL(iLSource, prependDefaultHeader: false, embedInteropTypes: false); 4272references: new MetadataReference[] { reference, CSharpRef }); 4295references: new MetadataReference[] { reference, CSharpRef }); 4382MetadataReference reference = CompileIL(iLSource, prependDefaultHeader: true, embedInteropTypes: false); 4396references: new MetadataReference[] { reference, CSharpRef }); 4412references: new MetadataReference[] { reference, CSharpRef });
Semantics\ForEachTests.cs (1)
3071var reference1 = MetadataReference.CreateFromStream(compilation1.EmitToStream());
Semantics\GenericConstraintsTests.cs (28)
190var reference = CreateCompilation(@" 226var reference = CreateCompilation(@" 265var reference = CreateCompilation(@" 304var reference = CreateCompilation(@" 358var reference = CreateCompilation(code).EmitToImageReference(); 549var reference = CreateCompilation(@" 595var reference = CreateCompilation(@" 814var reference = CreateCompilation(@" 842var reference = CreateCompilation(@" 870var reference = CreateCompilation(@" 915var reference = CreateCompilation(code).EmitToImageReference(); 1066var reference = CreateCompilation(@" 1110var reference = CreateCompilation(@" 1295var reference = CreateCompilation(@" 1323var reference = CreateCompilation(@" 1351var reference = CreateCompilation(@" 1397var reference = CreateCompilation(code).EmitToImageReference(); 1551var reference = CreateCompilation(@" 1595var reference = CreateCompilation(@" 1978var reference = CreateCompilation(@" 2013var reference = CreateCompilation(@" 2050var reference = CreateCompilation(@" 2093var reference = CreateCompilation(code).EmitToImageReference(); 2241var reference = CreateCompilation(@" 2363var reference = CreateCompilation(@" 2398var reference = CreateCompilation(@" 2405var reference1 = CreateCompilation(@" 2443var reference = CreateCompilation(@"
Semantics\GlobalUsingDirectiveTests.cs (1)
3362MetadataReference newCompImageRef = newComp.EmitToImageReference();
Semantics\ImplicitObjectCreationTests.cs (1)
21private static CSharpCompilation CreateCompilation(string source, CSharpCompilationOptions options = null, IEnumerable<MetadataReference> references = null)
Semantics\InheritanceBindingTests.cs (1)
8237var refs = new List<MetadataReference>(baseCompilations.Select(c => new CSharpCompilationReference(c)));
Semantics\InitOnlyMemberTests.cs (18)
3256var reference = CreateMetadataReferenceFromIlSource(il); 3347var reference = CreateMetadataReferenceFromIlSource(il); 3465var reference = CreateMetadataReferenceFromIlSource(il); 3564var reference = CreateMetadataReferenceFromIlSource(il); 3628var reference = CreateMetadataReferenceFromIlSource(il); 3687var reference = CreateMetadataReferenceFromIlSource(il); 3737var reference = CreateMetadataReferenceFromIlSource(il); 3805var reference = CreateMetadataReferenceFromIlSource(il); 3883var reference = CreateMetadataReferenceFromIlSource(il); 3971var reference = CreateMetadataReferenceFromIlSource(il); 4054var reference = CreateMetadataReferenceFromIlSource(il); 4611new MetadataReference[] { new CSharpCompilationReference(piaCompilation, embedInteropTypes: true) }, 4651var corlibWithoutIsExternalInitRef = CreateEmptyCompilation(corlib_cs, assemblyName: "corlibWithoutIsExternalInit") 4654var corlibWithIsExternalInitRef = CreateEmptyCompilation(corlib_cs + IsExternalInitTypeDefinition, assemblyName: "corlibWithIsExternalInit") 4657var libWithIsExternalInitRef = CreateEmptyCompilation(IsExternalInitTypeDefinition, references: new[] { corlibWithoutIsExternalInitRef }, assemblyName: "libWithIsExternalInit") 4660var libWithIsExternalInitRef2 = CreateEmptyCompilation(IsExternalInitTypeDefinition, references: new[] { corlibWithoutIsExternalInitRef }, assemblyName: "libWithIsExternalInit2") 4814var corlibWithoutIsExternalInitRef = AsReference(CreateEmptyCompilation(corlib_cs), useCompilationReference); 4815var corlibWithIsExternalInitRef = AsReference(CreateEmptyCompilation(corlib_cs + IsExternalInitTypeDefinition), useCompilationReference);
Semantics\InteractiveUsingTests.cs (4)
322var lib1 = CreateCompilation(string.Format(libSourceTemplate, 1), assemblyName: "Lib1").EmitToImageReference(); 323var lib2 = CreateCompilation(string.Format(libSourceTemplate, 2), assemblyName: "Lib2").EmitToImageReference(); 515var lib = CreateCompilation(libSource).EmitToImageReference(); 556var lib = CreateCompilation(libSource).EmitToImageReference();
Semantics\InterpolationTests.cs (7)
1846foreach (var reference in new[] { comp1.EmitToImageReference(), comp1.ToMetadataReference() }) 2262foreach (var reference in new[] { comp1.EmitToImageReference(), comp1.ToMetadataReference() }) 4424var handlerRef = CreateCompilation(handlerSource).EmitToImageReference(); 4441var handlerRef = CreateCompilation(handlerSource).EmitToImageReference(); 8253foreach (var d in new[] { dependency.EmitToImageReference(), dependency.ToMetadataReference() }) 8310foreach (var d in new[] { dependency.EmitToImageReference(), dependency.ToMetadataReference() }) 8432foreach (var d in new[] { dependency.EmitToImageReference(), dependency.ToMetadataReference() })
Semantics\LambdaTests.cs (5)
530new[] { MetadataReference.CreateFromImage(metadataStream.ToImmutable()) }); 575var csProject = CreateCompilation(Parse(csSource), new[] { MetadataReference.CreateFromImage(vbMetadata) }); 5665var refA = CompileIL(sourceA); 5696var refA = CompileIL(sourceA); 5733var refA = CompileIL(sourceA);
Semantics\LookupTests.cs (2)
618var refs = new MetadataReference[] { SystemDataRef }; 675var refs = new MetadataReference[] { SystemDataRef };
Semantics\NameOfTests.cs (1)
419MetadataReference[] references = new[] { SystemCoreRef, CSharpRef };
Semantics\NativeIntegerTests.cs (55)
186var ref2 = comp.EmitToImageReference(); 702var ref2 = comp.EmitToImageReference(); 846var ref1 = comp.EmitToImageReference(); 884var ref2 = comp.EmitToImageReference(); 957var ref1 = comp.EmitToImageReference(); 1001var ref2 = comp.EmitToImageReference(); 1050var refA1 = comp.EmitToImageReference(); 1053var refA2 = comp.EmitToImageReference(); 1138var ref1 = comp.EmitToImageReference(EmitOptions.Default.WithRuntimeMetadataVersion("0.0.0.0")); 1151var refA = AsReference(comp, useCompilationReference); 1218var ref1 = comp.EmitToImageReference(); 1513var ref2 = comp.EmitToImageReference(); 1524void verifyReference(MetadataReference reference, bool includesIEquatable) 1595var ref2 = comp.EmitToImageReference(); 1648var ref2 = comp.EmitToImageReference(); 1727var refA = AsReference(comp, useCompilationReference); 1895var refA = AsReference(comp, useCompilationReference); 2070var refA = AsReference(comp, useCompilationReference); 2208var refA = AsReference(comp, useCompilationReference); 2300var refA = AsReference(comp, useCompilationReference); 2430var compA = CreateVisualBasicCompilation(sourceA, referencedAssemblies: Array.Empty<MetadataReference>()); 2432var refA = compA.EmitToImageReference(); 2599var refA = AsReference(comp, useCompilationReference); 2703var refA = AsReference(comp, useCompilationReference); 2841var refA = CompileIL(sourceA, prependDefaultHeader: false, autoInherit: false); 3118var ref2 = comp.EmitToImageReference(); 3162var ref2 = comp.EmitToImageReference(); 3197var ref2 = comp.EmitToImageReference(); 3259var ref2 = comp.EmitToImageReference(); 3302var ref2 = comp.EmitToImageReference(); 3361var ref2 = comp.EmitToImageReference(); 3451var ref1 = comp.EmitToImageReference(); 3533var ref2 = comp.EmitToImageReference(); 3566var ref2 = comp.EmitToImageReference(); 3599var ref2 = comp.EmitToImageReference(); 4598var refA = comp.EmitToImageReference(options: EmitOptions.Default.WithRuntimeMetadataVersion("4.0.0.0")); 4885var refA = AsReference(comp, useCompilationReference); 4997var refA = AsReference(comp, useCompilationReference); 5340var refA = AsReference(comp, useCompilationReference); 5488var refA = AsReference(comp, useCompilationReference); 5536var refA = AsReference(comp, useCompilationReference); 5580var refA = AsReference(comp, useCompilationReference); 5672var refA = AsReference(comp, useCompilationReference); 5714var refA = AsReference(comp, useCompilationReference); 5783var refA = AsReference(comp, useCompilationReference); 5845var refA = AsReference(comp, useCompilationReference); 5890var refA = AsReference(comp, useCompilationReference); 6020var refA = AsReference(comp, useCompilationReference); 6942var ref0 = comp.EmitToImageReference(); 6971var ref0 = comp.EmitToImageReference(); 7004var ref0 = comp.EmitToImageReference(); 7219var ref2 = comp.EmitToImageReference(); 13281var refA = comp.EmitToImageReference(); 13654var refA = CompileIL(sourceA); 13717var refA = CompileIL(sourceA);
Semantics\NullableContextTests.cs (2)
275var refA = CreateCompilation(sourceA).EmitToImageReference(); 542var refA = CreateCompilation(sourceA).EmitToImageReference();
Semantics\NullableReferenceTypesTests.cs (134)
98IEnumerable<MetadataReference> references = null, 2062var reference = BasicCompilationUtils.CompileToMetadata(source1); 8707var ref0 = comp0.EmitToImageReference(); 8813var compRefs0 = new MetadataReference[] { new CSharpCompilationReference(comp0) }; 8836compRefs0 = new MetadataReference[] { new CSharpCompilationReference(comp0) }; 8866compRefs0 = new MetadataReference[] { new CSharpCompilationReference(comp0) }; 8945var comp1A = CreateCompilation(source1, references: new MetadataReference[] { new CSharpCompilationReference(comp0) }); 9159references: new MetadataReference[] { new CSharpCompilationReference(comp0) }); 9244var ref0 = comp0.EmitToImageReference(); 9248var ref1 = comp1.EmitToImageReference(); 9334var ref0 = comp0.EmitToImageReference(); 9338var ref1 = comp1.EmitToImageReference(); 9427var comp1 = CreateCompilation(source1, references: new MetadataReference[] { new CSharpCompilationReference(comp0) }); 14336foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 14388foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 34309var reference = CreateNullableCompilation(new[] { source1, NotNullIfNotNullAttributeDefinition }).EmitToImageReference(); 40307var ref0 = comp.EmitToImageReference(); 44289var ref0 = comp.EmitToImageReference(); 46237var ref0 = comp.EmitToImageReference(); 46287var ref0 = comp.EmitToImageReference(); 46794var ref0 = comp.EmitToImageReference(); 46850var ref0 = comp.EmitToImageReference(); 47455var ref0 = comp.EmitToImageReference(); 47503var ref0 = comp.EmitToImageReference(); 47544var ref0 = comp.EmitToImageReference(); 56664var ref0 = comp0.EmitToImageReference(); 56713var ref0 = comp0.EmitToImageReference(); 56788var ref0 = comp0.EmitToImageReference(); 56852var ref0 = comp0.EmitToImageReference(); 56899var ref0 = comp0.EmitToImageReference(); 56945var ref0 = comp0.EmitToImageReference(); 57306var ref0 = comp0.EmitToImageReference(); 57552var ref0 = comp0.EmitToImageReference(); 57567var ref1 = comp1.EmitToImageReference(); 58435var ref0 = comp0.EmitToImageReference(); 58450var ref1 = comp1.EmitToImageReference(); 60343var ref0 = comp0.EmitToImageReference(); 60468var ref0 = comp0.EmitToImageReference(); 60530var ref0 = comp0.EmitToImageReference(); 60585var ref0 = comp0.EmitToImageReference(); 60663var ref0 = comp0.EmitToImageReference(); 60752var ref0 = comp0.EmitToImageReference(); 60857var ref0 = comp0.EmitToImageReference(); 61144var ref0 = comp0.EmitToImageReference(); 61551" }, options: WithNullableEnable(), references: new MetadataReference[] { piaCompilation.ToMetadataReference(embedInteropTypes: true) }); 61602" }, options: WithNullableEnable(), references: new MetadataReference[] { piaCompilation.ToMetadataReference(embedInteropTypes: true) }); 64605var ref0 = comp0.EmitToImageReference(); 64663var ref0 = comp0.EmitToImageReference(); 64736var ref0 = comp0.EmitToImageReference(); 76928new MetadataReference[] { new CSharpCompilationReference(piaCompilation, embedInteropTypes: true) }, 80948var ref0 = BasicCompilationUtils.CompileToMetadata(source0); 81402var ref0 = comp0.EmitToImageReference(); 88108var ref0 = CompileIL(source0); 88136var ref0 = CompileIL(source0); 88169var ref0 = CompileIL(source0); 88198var ref0 = CompileIL(source0); 92822var ref0 = comp0.EmitToImageReference(); 92880var ref0 = comp0.EmitToImageReference(); 92922var ref0 = comp0.EmitToImageReference(); 92993var ref0 = comp0.EmitToImageReference(); 93037var ref0 = comp0.EmitToImageReference(); 93110var ref0 = comp0.EmitToImageReference(); 93154var ref0 = comp0.EmitToImageReference(); 93255var ref0 = comp0.EmitToImageReference(); 93296var ref0 = comp0.EmitToImageReference(); 93343var ref0 = comp0.EmitToImageReference(); 93538var ref0 = comp0.EmitToImageReference(); 93594var ref0 = comp0.EmitToImageReference(); 93667var ref0 = comp0.EmitToImageReference(); 93795var ref0 = comp0.EmitToImageReference(); 93833var ref0 = comp0.EmitToImageReference(); 93919var ref0 = comp0.EmitToImageReference(); 94131var ref0 = comp0.EmitToImageReference(); 94145var ref1 = comp1.EmitToImageReference(); 95149var ref0 = comp0.EmitToImageReference(); 101287foreach (var reference in new[] { comp1.ToMetadataReference(), comp1.EmitToImageReference() }) 101368foreach (var reference in new[] { comp1.ToMetadataReference(), comp1.EmitToImageReference() }) 106107foreach (var reference in new[] { comp1.ToMetadataReference(), comp1.EmitToImageReference() }) 109251foreach (var reference in new[] { comp0.ToMetadataReference(), comp0.EmitToImageReference() }) 110530var ref0 = CompileIL(source0); 110602var ref0 = CompileIL(source0); 110942var ref0 = CompileIL(source0); 110997MetadataReference ref0 = comp.ToMetadataReference(); 111323var ref0 = comp0.EmitToImageReference(); 111342var ref0 = comp0.EmitToImageReference(); 111372var ref0 = comp0.EmitToImageReference(); 111408var ref0 = comp0.EmitToImageReference(); 111441var ref0 = comp0.EmitToImageReference(); 111477var ref0 = comp0.EmitToImageReference(); 111510var ref0 = comp0.EmitToImageReference(); 111551var ref0 = comp0.EmitToImageReference(); 111847var ref0 = comp0.EmitToImageReference(); 111889var ref0 = comp0.EmitToImageReference(); 111910var ref0 = comp0.EmitToImageReference(); 111984var ref0 = comp0.EmitToImageReference(); 112072var ref0 = comp0.EmitToImageReference(); 112127var ref0 = comp0.EmitToImageReference(); 112212var ref0 = comp0.EmitToImageReference(); 112280var ref0 = comp0.EmitToImageReference(); 112533var ref0 = comp0.EmitToImageReference(); 112640MetadataReference ref0 = comp0.ToMetadataReference(); 116779var ref1 = BasicCompilationUtils.CompileToMetadata(source1); 138718var comp1 = CreateCompilation(source1, assemblyName: nameof(source1)).VerifyDiagnostics().EmitToImageReference(); 144959var spanRef = CreateCompilation(TestSources.Span, options: TestOptions.UnsafeReleaseDll) 149942var refA = AsReference(comp, useCompilationReference); 150215var refA = AsReference(comp, useCompilationReference); 150481var refA = AsReference(comp, useCompilationReference); 150604var refA = AsReference(comp, useCompilationReference); 151246var refA = AsReference(comp, useCompilationReference); 151621var refA = AsReference(comp, useCompilationReference); 151997var refA = AsReference(comp, useCompilationReference); 152370var refA = AsReference(comp, useCompilationReference); 152676var refA = AsReference(comp, useCompilationReference); 152967var refA = AsReference(comp, useCompilationReference); 153218var refA = AsReference(comp, useCompilationReference); 153425var refA = AsReference(comp, useCompilationReference); 154505var refA = AsReference(comp, useCompilationReference); 154583var refA = AsReference(comp, useCompilationReference); 154964var refA = AsReference(comp, useCompilationReference); 155064var refA = AsReference(comp, useCompilationReference); 155125var refA = AsReference(comp, useCompilationReference); 155288var refA = AsReference(comp, useCompilationReference); 155337var refA = AsReference(comp, useCompilationReference); 155381var refA = AsReference(comp, useCompilationReference); 155815var nullableAttrRef = useImageReference ? nullableAttrComp.EmitToImageReference() : nullableAttrComp.ToMetadataReference(); 155834var libRef = useImageReference ? lib.EmitToImageReference() : lib.ToMetadataReference(); 156547var ref0 = comp.EmitToImageReference(); 156595var ref0 = comp.EmitToImageReference(); 157009var ref0 = comp.EmitToImageReference(); 157045var ref0 = comp.EmitToImageReference(); 157201var refA = AsReference(comp, useCompilationReference); 160364" }, options: WithNullableEnable(), references: new MetadataReference[] { piaCompilation.ToMetadataReference(embedInteropTypes: true) }); 160415" }, options: WithNullableEnable(), references: new MetadataReference[] { piaCompilation.ToMetadataReference(embedInteropTypes: true) }); 160465" }, options: WithNullableEnable(), references: new MetadataReference[] { piaCompilation.ToMetadataReference(embedInteropTypes: true) });
Semantics\NullableTests.cs (1)
1800references: new MetadataReference[] { complib.EmitToImageReference() },
Semantics\ObjectAndCollectionInitializerTests.cs (2)
256CreateCompilation(source, references: new MetadataReference[] { CSharpRef }).VerifyDiagnostics(); 444CompileAndVerify(source, references: new MetadataReference[] { CSharpRef }).
Semantics\OverloadResolutionPerfTests.cs (1)
1038var refA = CompileIL(sourceA, prependDefaultHeader: false);
Semantics\OverloadResolutionTestBase.cs (2)
24internal void TestOverloadResolutionWithDiff(string source, MetadataReference[] additionalRefs = null) 31var references = new[] { mscorlibRef }.Concat(additionalRefs ?? Array.Empty<MetadataReference>());
Semantics\OverloadResolutionTests.cs (11)
770var reference = CompileIL(ilSource); 841var reference = CompileIL(ilSource); 928var reference = CompileIL(ilSource); 2306", new MetadataReference[] { new CSharpCompilationReference(cCommon) }, assemblyName: "cCS"); 2330new MetadataReference[] { new CSharpCompilationReference(cCommon) }); 11754var ref0 = CreateCompilation(source0).EmitToImageReference(); 11755var ref1 = CreateCompilation(source1, references: new[] { ref0 }).EmitToImageReference(); 11803var ref0 = CreateCompilation(source0).EmitToImageReference(); 11804var ref1 = CreateCompilation(source1, references: new[] { ref0 }).EmitToImageReference(); 11853var ref0 = CreateCompilation(source0).EmitToImageReference(); 11854var ref1 = CreateCompilation(source1, references: new[] { ref0 }).EmitToImageReference();
Semantics\RawInterpolationTests_Handler.cs (7)
214foreach (var reference in new[] { comp1.EmitToImageReference(), comp1.ToMetadataReference() }) 632foreach (var reference in new[] { comp1.EmitToImageReference(), comp1.ToMetadataReference() }) 2701var handlerRef = CreateCompilation(handlerSource).EmitToImageReference(); 2717var handlerRef = CreateCompilation(handlerSource).EmitToImageReference(); 6428foreach (var d in new[] { dependency.EmitToImageReference(), dependency.ToMetadataReference() }) 6487foreach (var d in new[] { dependency.EmitToImageReference(), dependency.ToMetadataReference() }) 6611foreach (var d in new[] { dependency.EmitToImageReference(), dependency.ToMetadataReference() })
Semantics\ReadOnlyStructsTests.cs (4)
1611var moduleMetadata = CreateCompilation(csharp, options: TestOptions.DebugModule, targetFramework: TargetFramework.Mscorlib461).EmitToImageReference(); 1616var dllMetadata = CreateCompilation(csharp, options: TestOptions.DebugDll, targetFramework: TargetFramework.Mscorlib461).EmitToImageReference(); 1639var moduleMetadata = CreateCompilation(csharp, options: TestOptions.DebugModule, targetFramework: TargetFramework.Mscorlib461).EmitToImageReference(); 1644var dllMetadata = CreateCompilation(csharp, options: TestOptions.DebugDll, targetFramework: TargetFramework.Mscorlib461).EmitToImageReference();
Semantics\RecordStructTests.cs (3)
33IEnumerable<MetadataReference>? references = null) 2285var corlibRef = CreateEmptyCompilation(corlib_cs).EmitToImageReference(); 2387var corlibRef = CreateEmptyCompilation(corlib_cs).EmitToImageReference();
Semantics\RefExtensionMethodsTests.cs (14)
660var reference = CompileIL(@" 694var reference = CompileIL(@" 730var reference = CompileIL(@" 766var reference = CompileIL(@" 802var reference = CompileIL(@" 837var reference = CompileIL(@" 873var reference = CompileIL(@" 1211var reference = CompileIL(ExtraRefReadOnlyIL + @" 1247var reference = CompileIL(ExtraRefReadOnlyIL + @" 1286var reference = CompileIL(ExtraRefReadOnlyIL + @" 1325var reference = CompileIL(ExtraRefReadOnlyIL + @" 1364var reference = CompileIL(ExtraRefReadOnlyIL + @" 1403var reference = CompileIL(ExtraRefReadOnlyIL + @" 1442var reference = CompileIL(ExtraRefReadOnlyIL + @"
Semantics\RefFieldTests.cs (72)
99var refA = AsReference(comp, useCompilationReference); 177var refA = AsReference(comp, useCompilationReference); 246var refA = AsReference(comp, useCompilationReference); 304var refA = CompileIL(sourceA); 361var refA = CompileIL(sourceA); 499var refA = CompileIL(sourceA); 528var refA = CompileIL(sourceA, prependDefaultHeader: false, embedInteropTypes: true); 542var refB = comp.EmitToImageReference(); 590var refA = CompileIL(sourceA); 619var refA = CompileIL(sourceA); 1874var refA = CompileIL(sourceA); 1906var refA = CompileIL(sourceA); 1937var refA = CompileIL(sourceA, prependDefaultHeader: false); 1946var refB = CompileIL(sourceB); 1979var refA = CompileIL(sourceA); 2004var refB = verifier.Compilation.EmitToImageReference(); 2088var refA = CompileIL(sourceA); 2145var refA = AsReference(comp, useCompilationReference); 2148var refAB = AsReference(comp, useCompilationReference); 2229var refA = compA.EmitToImageReference(emitOptions); 2247var refB = compB.EmitToImageReference(); 2338var refA = AsReference(comp, useCompilationReference); 2466var refA = CompileIL(sourceA); 10158var refA = comp.EmitToImageReference(); 10621var refA = AsReference(comp, useCompilationReference); 10652var refA = AsReference(comp, useCompilationReference); 10686var refA = AsReference(comp, useCompilationReference); 10745var refA = AsReference(comp, useCompilationReference); 10801var refA = AsReference(comp, useCompilationReference); 10843var refA = AsReference(comp, useCompilationReference); 10893var refA = AsReference(comp, useCompilationReference); 11423var ref0 = CompileIL(source0, prependDefaultHeader: false); 11453var refA = AsReference(comp, useCompilationReference); 15743var refA = comp.EmitToImageReference(embedInteropTypes: true); 17229var refA = AsReference(comp, useCompilationReference); 17284var refA = AsReference(comp, useCompilationReference); 17334var refA = AsReference(comp, useCompilationReference); 17442var refA = AsReference(comp, useCompilationReference); 17537var refA = AsReference(comp, useCompilationReference); 17611var refA = AsReference(comp, useCompilationReference); 22387var refA = AsReference(comp, useCompilationReference); 22505var refA = AsReference(comp, useCompilationReference); 22802var refA = AsReference(comp, useCompilationReference); 23087var refA = AsReference(comp, useCompilationReference); 23276var refA = CompileIL(ilSource); 23374var refA = AsReference(comp, useCompilationReference); 24145var refA = AsReference(comp, useCompilationReference); 24361var refA = CompileIL(sourceA, prependDefaultHeader: false); 24467var refA = CompileIL(sourceA, prependDefaultHeader: false); 24575var refA = CompileIL(sourceA, prependDefaultHeader: false); 24702var refA = AsReference(comp, useCompilationReference); 24786var refA = AsReference(comp, useCompilationReference); 24885var refA = AsReference(comp, useCompilationReference); 24936var refA = AsReference(comp, useCompilationReference); 24995var refA = AsReference(comp, useCompilationReference); 25025var refA = AsReference(comp, useCompilationReference); 25063var refA = AsReference(comp, useCompilationReference); 25122var refA = AsReference(comp, useCompilationReference); 25200var refA = AsReference(comp, useCompilationReference); 25271var refA = AsReference(comp, useCompilationReference); 25387var refA = AsReference(comp, useCompilationReference); 25435var refA = AsReference(comp, useCompilationReference); 26409var refA = CompileIL(sourceA, prependDefaultHeader: false); 26454var refA = CompileIL(sourceA, prependDefaultHeader: false); 26493var refA = CompileIL(sourceA, prependDefaultHeader: false); 26592var ref0 = comp.EmitToImageReference(Microsoft.CodeAnalysis.Emit.EmitOptions.Default.WithRuntimeMetadataVersion("0.0.0.0")); 26601var ref1 = comp.EmitToImageReference(); 26649var refLowerVersion = comp.EmitToImageReference(); 26653var refHigherVersion = comp.EmitToImageReference(); 26662var ref1 = comp.EmitToImageReference(); 26717var ref0 = comp.EmitToImageReference(Microsoft.CodeAnalysis.Emit.EmitOptions.Default.WithRuntimeMetadataVersion("0.0.0.0")); 26726var ref1 = comp.EmitToImageReference();
Semantics\ScriptSemanticsTests.cs (8)
101references: new MetadataReference[] { TaskFacadeAssembly(), MscorlibRef_v20 }); 118references: new MetadataReference[] { TaskFacadeAssembly(false), MscorlibRef_v20 }); 143references: new MetadataReference[] { TaskFacadeAssembly() }); 163references: new MetadataReference[] { TaskFacadeAssembly(), MscorlibRef_v20 }); 192references: new MetadataReference[] { TaskFacadeAssembly(), MscorlibRef_v20 }); 211references: new MetadataReference[] { TaskFacadeAssembly(), MscorlibRef_v20 }); 613new[] { MetadataReference.CreateFromAssemblyInternal(typeof(B2).GetTypeInfo().Assembly) }, 1375references: new MetadataReference[] { TaskFacadeAssembly(), MscorlibRef_v20 });
Semantics\ScriptTestFixtures.cs (2)
18internal static MetadataReference HostRef = MetadataReference.CreateFromAssemblyInternal(typeof(ScriptTestFixtures).GetTypeInfo().Assembly);
Semantics\SemanticErrorTests.cs (8)
4556var reference1 = MetadataReference.CreateFromImage(compilationVerifier.EmittedAssemblyData); 7804var reference1 = MetadataReference.CreateFromImage(compilationVerifier.EmittedAssemblyData); 7892var comp = CreateCompilation(new[] { Parse(test, options: TestOptions.Regular6) }, new MetadataReference[] { }); 12926", new List<MetadataReference> { systemRef }) 13252var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 13304var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 13362var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 13441var reference1 = BasicCompilationUtils.CompileToMetadata(source1, verify: Verification.Passes);
Semantics\SpanStackSafetyTests.cs (8)
1929references: new List<MetadataReference>() { MscorlibRef_v4_0_30316_17626, SystemCoreRef, CSharpRef }, 1946references: new List<MetadataReference>() { MscorlibRef_v4_0_30316_17626, SystemCoreRef, CSharpRef, reference.EmitToImageReference() }, 1963references: new List<MetadataReference>() { MscorlibRef_v4_0_30316_17626, SystemCoreRef, CSharpRef }, 1980references: new List<MetadataReference>() { MscorlibRef_v4_0_30316_17626, SystemCoreRef, CSharpRef, reference.EmitToImageReference() }, 2007references: new List<MetadataReference>() { MscorlibRef_v4_0_30316_17626, SystemCoreRef, CSharpRef }, 2024references: new List<MetadataReference>() { MscorlibRef_v4_0_30316_17626, SystemCoreRef, CSharpRef, reference.EmitToImageReference() }, 2048references: new List<MetadataReference>() { MscorlibRef_v4_0_30316_17626, SystemCoreRef, CSharpRef }, 2065references: new List<MetadataReference>() { MscorlibRef_v4_0_30316_17626, SystemCoreRef, CSharpRef, reference.EmitToImageReference() },
Semantics\StackAllocSpanExpressionsTests.cs (1)
779var references = new List<MetadataReference>() { MscorlibRef_v4_0_30316_17626, SystemCoreRef, CSharpRef };
Semantics\StructConstructorTests.cs (3)
37var refA = AsReference(comp, useCompilationReference); 169var refA = CompileIL(sourceA); 3665var refA = comp.EmitToImageReference(embedInteropTypes: true);
Semantics\SuppressAccessibilityChecksTests.cs (4)
31var referenceA = MetadataReference.CreateFromStream(compilationA.EmitToStream()); 44", new MetadataReference[] { referenceA }, TestOptions.ReleaseDll.WithMetadataImportOptions(MetadataImportOptions.All)); 153var referenceA = MetadataReference.CreateFromStream(compilationA.EmitToStream()); 164", new MetadataReference[] { referenceA }, TestOptions.ReleaseDll.WithMetadataImportOptions(MetadataImportOptions.All));
Semantics\UnsafeTests.cs (6)
61var ref1 = comp1.EmitToImageReference(); 6345var metadata = CreateCompilation(externalCode).EmitToImageReference(); 12416references: new MetadataReference[] { MetadataReference.CreateFromImage(comp1.EmitToArray()) }, 12467references: new MetadataReference[] { MetadataReference.CreateFromImage(comp1.EmitToArray()) }).Compilation;
Semantics\UseSiteErrorTests.cs (24)
936CreateCompilation(text, new MetadataReference[] { delegatesWithoutInvokeReference }).VerifyDiagnostics( 997CreateCompilation(text, new MetadataReference[] { csharpAssemblyReference, ilAssemblyReference }).VerifyDiagnostics( 1075var xRef = CreateCompilation(xSource, assemblyName: "Test").EmitToImageReference(); 1107var xRef = CreateCompilation(xSource, assemblyName: "X").EmitToImageReference(); 1136var xRef = CreateCompilation(xSource, assemblyName: "X").EmitToImageReference(); 1661var missingRef = CreateCompilation(missingSource, assemblyName: "Missing").EmitToImageReference(); 1662var libRef = CreateCompilation(libSource, new[] { missingRef }).EmitToImageReference(); 1732var missingRef = CreateCompilation(missingSource, assemblyName: "Missing").EmitToImageReference(); 1733var libRef = CreateCompilation(libSource, new[] { missingRef }).EmitToImageReference(); 1787var missingRef = CreateCompilation(missingSource, assemblyName: "Missing").EmitToImageReference(); 1788var libRef = CreateCompilation(libSource, new[] { missingRef }).EmitToImageReference(); 1844var missingRef = CreateCompilation(missingSource, assemblyName: "Missing").EmitToImageReference(); 1845var libRef = CreateCompilation(libSource, new[] { missingRef }).EmitToImageReference(); 1901var missingRef = CreateCompilation(missingSource, assemblyName: "Missing").EmitToImageReference(); 1902var libRef = CreateCompilation(libSource, new[] { missingRef }).EmitToImageReference(); 1948var missingRef = CreateCompilation(missingSource, assemblyName: "Missing").EmitToImageReference(); 1949var libRef = CreateCompilation(libSource, new[] { missingRef }).EmitToImageReference(); 2195CSharpCompilation comp2 = CreateCompilation(source2, new MetadataReference[] { new CSharpCompilationReference(comp1) }); 2213CSharpCompilation comp3 = CreateCompilation(source3, new MetadataReference[] { new CSharpCompilationReference(comp2) }); 2233comp3 = CreateCompilation(source3, new MetadataReference[] { comp2.EmitToImageReference() }); 2284var successfulCompilation = CreateCompilation(source, new MetadataReference[] { unavailableAssemblyReference, csharpAssemblyReference, ilAssemblyReference }); 2287var failingCompilation = CreateCompilation(source, new MetadataReference[] { csharpAssemblyReference, ilAssemblyReference }); 2458private static readonly MetadataReference UnmanagedUseSiteError_Ref1 = CreateCompilation(@" 2464private static readonly MetadataReference UnmanagedUseSiteError_Ref2 = CreateCompilation(@"
Semantics\WarningVersionTests.cs (9)
383var moduleReference = comp1.EmitToImageReference(); 392CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( 394CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( 672var moduleReference = comp1.EmitToImageReference(); 683CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( 685CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( 702var moduleReference = comp1.EmitToImageReference(); 713CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( 715CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics(
SourceGeneration\GeneratorDriverTests.cs (2)
3223MetadataReference.CreateFromAssemblyInternal(this.GetType().Assembly), 3224MetadataReference.CreateFromAssemblyInternal(typeof(object).Assembly)
SourceGeneration\GeneratorDriverTests_Attributes_FullyQualifiedName.cs (1)
1240var comp0 = CreateCompilation(source0).VerifyDiagnostics().EmitToImageReference();
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1368)
BadSymbolReference.cs (8)
41}", new MetadataReference[] { cl2, cl3 }); 360var compilation2 = CreateCompilation(a_cs, new MetadataReference[] { cl3 }); 460var cl3Compilation = CreateCompilation(cl3Source, new MetadataReference[] { cl2 }); 464var compilation3 = CreateCompilation(a_cs, new MetadataReference[] { new CSharpCompilationReference(cl3Compilation) }); 468var cl3BadCompilation1 = CreateCompilation(cl3Source, new MetadataReference[] { cl3 }); 470var compilation4 = CreateCompilation(a_cs, new MetadataReference[] { new CSharpCompilationReference(cl3BadCompilation1) }); 601var compilation5 = CreateCompilation(a_cs, new MetadataReference[] { new CSharpCompilationReference(cl3BadCompilation2) }); 796var libRef = CreateEmptyCompilation(libSource, new[] { MscorlibRef }, assemblyName: "System.Drawing").EmitToImageReference();
Compilation\CompilationAPITests.cs (55)
339var listRef = new List<MetadataReference>(); 366var ref1 = comp.ExternalReferences[0]; 495comp = comp.AddReferences(Enumerable.Empty<MetadataReference>()); 518var hs = new HashSet<MetadataReference> { ref1, ref2, ref3 }; 526var col = new Collection<MetadataReference> { ref1, ref2, ref3 }; 534var stack = new ConcurrentStack<MetadataReference> { }; 545var queue = new ConcurrentQueue<MetadataReference> { }; 615references: new MetadataReference[] { MscorlibRef }); 617var mtref = refcomp.EmitToImageReference(aliases: ImmutableArray.Create("a", "Alias(*#$@^%*&)")); 625references: new MetadataReference[] { MscorlibRef, mtref } 636references: new MetadataReference[] { MscorlibRef, mtref } 649references: new MetadataReference[] { MscorlibRef, mtref } 683references: new MetadataReference[] { MscorlibRef }); 685var mtref = refcomp.EmitToImageReference(aliases: ImmutableArray.Create("a", "Alias(*#$@^%*&)")); 693references: new MetadataReference[] { MscorlibRef, mtref } 704references: new MetadataReference[] { MscorlibRef, mtref } 717references: new MetadataReference[] { MscorlibRef, mtref } 966var listRef = new List<MetadataReference>(); 989references: new MetadataReference[] { netModule1.EmitToImageReference() }, 1003references: new MetadataReference[] { netModule2.EmitToImageReference() }, 1018references: new MetadataReference[] { netModule1.EmitToImageReference(), netModule2.EmitToImageReference() }, 1045references: new MetadataReference[] { netModule1.EmitToImageReference() }, 1059references: new MetadataReference[] { netModule1.EmitToImageReference() }, 1073references: new MetadataReference[] { netModule2.EmitToImageReference(), netModule3.EmitToImageReference() }, 1109references: new MetadataReference[] { netModule1.EmitToImageReference() }, 1134references: new MetadataReference[] { netModule1.EmitToImageReference() }, 1148references: new MetadataReference[] { netModule1.EmitToImageReference(), netModule2.EmitToImageReference() }, 1169foreach (var item in vbComp.References) 1192new MetadataReference[] { compRef1, compRef2 }); 1299foreach (var item in comp.References) 1342Assert.Throws<ArgumentNullException>(() => CSharpCompilation.Create("goo", references: new MetadataReference[] { null })); 1421var listRef = new List<MetadataReference> { ref1, ref2, ref3, ref4 }; 1435var ref1 = InvalidRef; 2248var references = new MetadataReference[] 2299var mdRef = MetadataReference.CreateFromImage(refData); 2353var reference = comp.GetMetadataReference(assemblySmb); 2358var reference2 = comp2.GetMetadataReference(assemblySmb); 2778var compilation = CreateCompilation("", references: Array.Empty<MetadataReference>(), targetFramework: TargetFramework.Empty); 2968var compilation = CreateCompilation("", references: Array.Empty<MetadataReference>(), targetFramework: TargetFramework.Empty); 3101var moduleReference = MetadataReference.CreateFromStream(moduleStream, MetadataReferenceProperties.Module); 3120var moduleReference = MetadataReference.CreateFromStream(moduleStream, MetadataReferenceProperties.Module); 3141var moduleReference = MetadataReference.CreateFromStream(moduleStream, MetadataReferenceProperties.Assembly); 3470MetadataReference reference = useMetadataReference ? referenceComp.ToMetadataReference() : referenceComp.EmitToImageReference(); 3498MetadataReference reference = useMetadataReference ? referenceComp.ToMetadataReference() : referenceComp.EmitToImageReference(); 3526MetadataReference reference1 = getReference(referenceComp1); 3527MetadataReference reference2 = getReference(referenceComp2); 3543MetadataReference getReference(CSharpCompilation referenceComp1) 3564MetadataReference reference1 = getReference(referenceComp1); 3565MetadataReference reference2 = getReference(referenceComp2); 3583MetadataReference getReference(CSharpCompilation referenceComp1) 3604var corlibReference = corlib.EmitToImageReference(); 3607var otherReference = other.EmitToImageReference(); 3639var corlibReference = corlib.EmitToImageReference(aliases: ImmutableArray.Create("corlib")); 3664var corlibReference = corlib.EmitToImageReference(); 3667var otherReference = other.EmitToImageReference(aliases: ImmutableArray.Create("other"));
Compilation\GetImportScopesTests.cs (1)
403var reference = comp.References.First(r => r.Display!.StartsWith("System.Core"));
Compilation\GetSemanticInfoTests.cs (3)
3894var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 3934var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 3982var reference1 = BasicCompilationUtils.CompileToMetadata(source1);
Compilation\IndexedProperties_BindingTests.cs (8)
27var reference = GetReference(); 48var reference = GetReference(); 69var reference = GetReference(); 90var reference = GetReference(); 110var reference = GetReference(); 133private void IndexedPropertiesBindingChecks(string source, MetadataReference reference, SymbolKind symbolKind, string name) 179private static MetadataReference GetReference() 205var reference = BasicCompilationUtils.CompileToMetadata(COMSource, verify: Verification.Passes);
Compilation\ReferenceManagerTests.cs (147)
39var ifaceImageRef = ifaceDef.EmitToImageReference(); 51}", references: new MetadataReference[] { ifaceDef.ToMetadataReference(), wimpl }, 70var testRefV1 = CreateCompilation("public class E : D { }", new MetadataReference[] { new CSharpCompilationReference(refV1), v2 }, assemblyName: "testRefV1"); 73var testRefV2 = CreateCompilation("public class E : D { }", new MetadataReference[] { new CSharpCompilationReference(refV2), v1 }, assemblyName: "testRefV2"); 105var v1 = MetadataReference.CreateFromImage(TestResources.General.C1); 106var v2 = MetadataReference.CreateFromImage(TestResources.General.C2); 112var testRefV1 = CreateCompilation("public class E { }", new MetadataReference[] { new CSharpCompilationReference(refV1), v2 }); 115var testRefV2 = CreateCompilation("public class E { }", new MetadataReference[] { new CSharpCompilationReference(refV2), v1 }); 559references: new MetadataReference[] { MinCorlibRef, new CSharpCompilationReference(libV1) }, 573references: new MetadataReference[] { MinCorlibRef, new CSharpCompilationReference(refLibV1), new CSharpCompilationReference(libV2) }); 707references: new MetadataReference[] { MetadataReference.CreateFromImage(refLibV1.EmitToArray()), new CSharpCompilationReference(libV2) }, 829CSharpCompilation createCompilationCore(string s, IEnumerable<MetadataReference> references) 856var r1 = MetadataReference.CreateFromFile(p1); 857var r2 = MetadataReference.CreateFromFile(p2); 858var r3 = MetadataReference.CreateFromFile(p3); 868references: new MetadataReference[] { MscorlibRef_v4_0_30316_17626, r1, r2 }, 927var m1 = MetadataReference.CreateFromFile(p1, new MetadataReferenceProperties(MetadataImageKind.Module)); 928var m2 = MetadataReference.CreateFromFile(p2, new MetadataReferenceProperties(MetadataImageKind.Module)); 931references: new MetadataReference[] { m1, m2 }); 996var r1 = MetadataReference.CreateFromFile(p1); 997var r2 = MetadataReference.CreateFromFile(p2); 1020new[] { MetadataReference.CreateFromFile(p1), MetadataReference.CreateFromFile(p2) }, 1252return ImmutableArray.Create(MetadataReference.CreateFromFile(path1)); 1256return ImmutableArray.Create(MetadataReference.CreateFromFile(path2)); 1394var refB = MetadataReference.CreateFromImage(b.EmitToArray()); 1404var refA2 = MetadataReference.CreateFromImage(a2.EmitToArray()); 1441var refB = MetadataReference.CreateFromImage(b.EmitToArray()); 1445var refA2 = MetadataReference.CreateFromImage(a2.EmitToArray()); 1548var ilRef = CompileIL(il, prependDefaultHeader: false); 1556var ilRef = CompileIL(il, prependDefaultHeader: false); 1563var ilRef = CompileIL(il, prependDefaultHeader: false); 1570var ilRef = CompileIL(il, prependDefaultHeader: false); 1644var ilRef = CompileIL(il, prependDefaultHeader: false); 1698var aRef = CompileIL(srcA, prependDefaultHeader: false); 1764var moduleRef = CreateCompilation("public class TypeFromModule : TypeDependedOnByModule { }", new[] { assemblyRef }, options: TestOptions.ReleaseModule, assemblyName: "lib2").EmitToImageReference(); 1766var comp1 = CreateCompilation(text1, new MetadataReference[] 1815var moduleRef = CreateCompilation("public class C { }", options: TestOptions.ReleaseModule, assemblyName: "lib").EmitToImageReference(); 1817var comp1 = CreateCompilation(text1, new MetadataReference[] 1865var moduleRef = module.EmitToImageReference(); 1894var main = CreateEmptyCompilation(mainSource, new MetadataReference[] { r1, MscorlibFacadeRef }, options: TestOptions.ReleaseDll); 1900main = CreateEmptyCompilation(mainSource, new MetadataReference[] { r1, MscorlibFacadeRef, SystemRuntimeFacadeRef }); 2180var refVectors40 = vectors40.EmitToImageReference(); 2181var refVectors41 = vectors41.EmitToImageReference(); 2317var bRef = CreateCompilationWithMscorlib461("public class B { }", assemblyName: "B").EmitToImageReference(); 2318var aRef = CreateCompilationWithMscorlib461("public class A : B { }", new[] { bRef }, assemblyName: "A").EmitToImageReference(); 2347var bRef = CreateCompilationWithMscorlib461("public class B { }", assemblyName: "B").EmitToImageReference(); 2348var aRef = CreateCompilationWithMscorlib461("public class A : B { }", new[] { bRef }, assemblyName: "A").EmitToImageReference(); 2379var bRef = CreateCompilationWithMscorlib461("public class B { }", assemblyName: "B").EmitToImageReference(); 2380var aRef = CreateCompilationWithMscorlib461("public class A : B { }", new[] { bRef }, assemblyName: "A").EmitToImageReference(); 2415var bRef = CreateCompilationWithMscorlib461("public class B { }", assemblyName: "B").EmitToImageReference(); 2416var aRef = CreateCompilationWithMscorlib461("public class A : B { }", new[] { bRef }, assemblyName: "A").EmitToImageReference(); 2451var bRef = CreateCompilationWithMscorlib461("public class B { }", assemblyName: "B").EmitToImageReference(); 2452var aRef = CreateCompilationWithMscorlib461("public class A : B { }", new[] { bRef }, assemblyName: "A").EmitToImageReference(); 2489var bRef = CreateCompilationWithMscorlib461("public class B { }", assemblyName: "B").EmitToImageReference(); 2490var aRef = CreateCompilationWithMscorlib461("public class A : B { }", new[] { bRef }, assemblyName: "A").EmitToImageReference(); 2491var dRef = CreateCompilationWithMscorlib461("public class D : A { }", new[] { aRef, bRef }, assemblyName: "D").EmitToImageReference(); 2527var bRef = CreateCompilationWithMscorlib46("public class B { }", assemblyName: "B").EmitToImageReference(); 2528var aRef = CreateCompilationWithMscorlib46("public class A : B { }", new[] { bRef }, assemblyName: "A").EmitToImageReference(); 2530var resolver = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference> 2549var bRef = CreateCompilationWithMscorlib46("public class B { }", assemblyName: "B").EmitToImageReference(); 2550var aRef = CreateCompilationWithMscorlib46("public class A : B { }", new[] { bRef }, assemblyName: "A").EmitToImageReference(); 2552var resolver = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference> 2577var b1Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public class B { }", new[] { MscorlibRef }, options: s_signedDll, assemblyName: "B").EmitToImageReference(); 2578var b2Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""2.0.0.0"")] public class B { }", new[] { MscorlibRef }, options: s_signedDll, assemblyName: "B").EmitToImageReference(); 2579var b3Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""3.0.0.0"")] public class B { }", new[] { MscorlibRef }, options: s_signedDll, assemblyName: "B").EmitToImageReference(); 2581var aRef = CreateEmptyCompilation("public class A : B { }", new[] { MscorlibRef, b1Ref }, assemblyName: "A").EmitToImageReference(); 2582var dRef = CreateEmptyCompilation("public class D : B { }", new[] { MscorlibRef, b2Ref }, assemblyName: "D").EmitToImageReference(); 2584var b3RefX = b3Ref.WithAliases(ImmutableArray.Create("X")); 2585var b3RefY = b3Ref.WithAliases(ImmutableArray.Create("Y")); 2587var resolver = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference> 2631var b1Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface B { }", new[] { MscorlibRef }, assemblyName: "B").EmitToImageReference(); 2632var b2Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""2.0.0.0"")] public interface B { }", new[] { MscorlibRef }, assemblyName: "B").EmitToImageReference(); 2633var b3Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""3.0.0.0"")] public interface B { }", new[] { MscorlibRef }, assemblyName: "B").EmitToImageReference(); 2634var b4Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""4.0.0.0"")] public interface B { }", new[] { MscorlibRef }, assemblyName: "B").EmitToImageReference(); 2636var aRef = CreateEmptyCompilation(@"public interface A : B { }", new[] { MscorlibRef, b1Ref }, assemblyName: "A").EmitToImageReference(); 2637var dRef = CreateEmptyCompilation(@"public interface D : B { }", new[] { MscorlibRef, b2Ref }, assemblyName: "D").EmitToImageReference(); 2639var resolver = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference> 2667var b1Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface B { }", new[] { MscorlibRef }, assemblyName: "B").EmitToImageReference(); 2668var b2Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""2.0.0.0"")] public interface B { }", new[] { MscorlibRef }, assemblyName: "B").EmitToImageReference(); 2669var b3Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""3.0.0.0"")] public interface B { }", new[] { MscorlibRef }, assemblyName: "B").EmitToImageReference(); 2670var b4Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""4.0.0.0"")] public interface B { }", new[] { MscorlibRef }, assemblyName: "B").EmitToImageReference(); 2672var aRef = CreateEmptyCompilation(@"public interface A : B { }", new[] { MscorlibRef, b1Ref }, assemblyName: "A").EmitToImageReference(); 2673var dRef = CreateEmptyCompilation(@"public interface D : B { }", new[] { MscorlibRef, b2Ref }, assemblyName: "D").EmitToImageReference(); 2675var resolver = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference> 2703var dRef = CreateCompilationWithMscorlib46("public interface D { }", assemblyName: "D").EmitToImageReference(); 2706var resolver = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference>()); 2719var dRef = CreateCompilationWithMscorlib46("public interface D { }", assemblyName: "D").EmitToImageReference(); 2722var resolver = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference>()); 2742var bRef = CreateCompilationWithMscorlib46("public interface D { }", assemblyName: "B").EmitToImageReference(); 2747var resolver = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference> 2768var dRef = CreateCompilationWithMscorlib46("public interface D { }", assemblyName: "D").EmitToImageReference(); 2772var resolver = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference> 2795var bRef = CreateCompilationWithMscorlib46("public interface B { }", assemblyName: "B").EmitToImageReference(); 2796var dRef = CreateCompilationWithMscorlib46("public interface D { }", assemblyName: "D").EmitToImageReference(); 2798var mRef = CreateCompilationWithMscorlib46("public interface M : B { }", new[] { bRef }, options: TestOptions.ReleaseModule.WithModuleName("M.netmodule")).EmitToImageReference(); 2799var nRef = CreateCompilationWithMscorlib46("public interface N : D { }", new[] { dRef }, options: TestOptions.ReleaseModule.WithModuleName("N.netmodule")).EmitToImageReference(); 2801var aRef = CreateCompilationWithMscorlib46("public interface A : D { }", new[] { dRef }, assemblyName: "A").EmitToImageReference(); 2803var resolver = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference> 2832var b1Ref = CreateCompilationWithMscorlib46(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public class B { }", options: s_signedDll, assemblyName: "B").EmitToImageReference(); 2833var b2Ref = CreateCompilationWithMscorlib46(@"[assembly: System.Reflection.AssemblyVersion(""2.0.0.0"")] public class B { }", options: s_signedDll, assemblyName: "B").EmitToImageReference(); 2834var b3Ref = CreateCompilationWithMscorlib46(@"[assembly: System.Reflection.AssemblyVersion(""3.0.0.0"")] public class B { }", options: s_signedDll, assemblyName: "B").EmitToImageReference(); 2836var aRef = CreateCompilationWithMscorlib46(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public class A : B { }", new[] { b1Ref }, options: s_signedDll, assemblyName: "A").EmitToImageReference(); 2838var resolver = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference> 2873var b1Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface B { }", new[] { MscorlibRef }, options: s_signedDll, assemblyName: "B").EmitToImageReference(); 2874var b2Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""2.0.0.0"")] public interface B { }", new[] { MscorlibRef }, options: s_signedDll, assemblyName: "B").EmitToImageReference(); 2876var dRef = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface D : B { }", new[] { MscorlibRef, b2Ref }, options: s_signedDll, assemblyName: "D").EmitToImageReference(); 2877var eRef = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface E : B { }", new[] { MscorlibRef, b1Ref }, options: s_signedDll, assemblyName: "E").EmitToImageReference(); 2879var resolverA = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference> 2885var aRef = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface A : D, E { }", new[] { MscorlibRef, dRef, eRef }, 2890var resolverC = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference> 2939var b1Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface B { }", references: new[] { MscorlibRef }, options: s_signedDll, assemblyName: "B").EmitToImageReference(); 2940var b2Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""2.0.0.0"")] public interface B { }", references: new[] { MscorlibRef }, options: s_signedDll, assemblyName: "B").EmitToImageReference(); 2942var dRef = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface D : B { }", new[] { MscorlibRef, b2Ref }, options: s_signedDll, assemblyName: "D").EmitToImageReference(); 2943var eRef = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface E : B { }", new[] { MscorlibRef, b1Ref }, options: s_signedDll, assemblyName: "E").EmitToImageReference(); 2945var resolverA = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference> 2951var aRef = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface A : D, E { }", new[] { MscorlibRef, dRef, eRef }, 2956var resolverC = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference> 2999var b1Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface B { }", new[] { MscorlibRef }, options: s_signedDll, assemblyName: "B").EmitToImageReference(); 3000var b2Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""2.0.0.0"")] public interface B { }", new[] { MscorlibRef }, options: s_signedDll, assemblyName: "B").EmitToImageReference(); 3002var dRef = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface D : B { }", new[] { MscorlibRef, b2Ref }, options: s_signedDll, assemblyName: "D").EmitToImageReference(); 3003var eRef = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface E : B { }", new[] { MscorlibRef, b1Ref }, options: s_signedDll, assemblyName: "E").EmitToImageReference(); 3005var aRef = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface A : D, E { }", new[] { MscorlibRef, dRef, eRef, b1Ref, b2Ref }, 3008var resolverC = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference> 3043var b1Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface B { }", new[] { MscorlibRef }, options: s_signedDll, assemblyName: "B").EmitToImageReference(); 3044var b2Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""2.0.0.0"")] public interface B { }", new[] { MscorlibRef }, options: s_signedDll, assemblyName: "B").EmitToImageReference(); 3045var b3Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""3.0.0.0"")] public interface B { }", new[] { MscorlibRef }, options: s_signedDll, assemblyName: "B").EmitToImageReference(); 3046var b4Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""4.0.0.0"")] public interface B { }", new[] { MscorlibRef }, options: s_signedDll, assemblyName: "B").EmitToImageReference(); 3048var dRef = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface D : B { }", new[] { MscorlibRef, b2Ref }, options: s_signedDll, assemblyName: "D").EmitToImageReference(); 3049var eRef = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface E : B { }", new[] { MscorlibRef, b1Ref }, options: s_signedDll, assemblyName: "E").EmitToImageReference(); 3051var aRef = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface A : D, E { }", new[] { MscorlibRef, dRef, eRef, b1Ref, b2Ref }, 3054var resolverC = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference> 3109var b1Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface B { }", new[] { MscorlibRef }, options: s_signedDll, assemblyName: "B").EmitToImageReference(); 3110var b2Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""2.0.0.0"")] public interface B { }", new[] { MscorlibRef }, options: s_signedDll, assemblyName: "B").EmitToImageReference(); 3111var b3Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""3.0.0.0"")] public interface B { }", new[] { MscorlibRef }, options: s_signedDll, assemblyName: "B").EmitToImageReference(); 3112var b4Ref = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""4.0.0.0"")] public interface B { }", new[] { MscorlibRef }, options: s_signedDll, assemblyName: "B").EmitToImageReference(); 3114var dRef = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface D : B { }", new[] { MscorlibRef, b2Ref }, options: s_signedDll, assemblyName: "D").EmitToImageReference(); 3115var eRef = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface E : B { }", new[] { MscorlibRef, b1Ref }, options: s_signedDll, assemblyName: "E").EmitToImageReference(); 3117var aRef = CreateEmptyCompilation(@"[assembly: System.Reflection.AssemblyVersion(""1.0.0.0"")] public interface A : D, E { }", new[] { MscorlibRef, dRef, eRef, b1Ref, b2Ref }, 3120var resolverC = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference> 3178var aRef = CreateEmptyCompilation(@"public interface A { System.Diagnostics.Process PA { get; } }", new[] { Net20.References.mscorlib, Net20.References.System }, 3181var bRef = CreateEmptyCompilation(@"public interface B { System.Diagnostics.Process PB { get; } }", new[] { MscorlibRef_v4_0_30316_17626, NetFramework.System }, 3184var resolverC = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference> 3218var aRef = CreateEmptyCompilation(@"public interface A { C CA { get; } }", new[] { MscorlibRef, TestReferences.SymbolsTests.Versioning.C2 }, 3221var bRef = CreateEmptyCompilation(@"public interface B { C CB { get; } }", new[] { MscorlibRef, TestReferences.SymbolsTests.Versioning.C1 }, 3224var resolverC = new TestMissingMetadataReferenceResolver(new Dictionary<string, MetadataReference>
Compilation\SemanticModelAPITests.cs (2)
1259var ref1 = comp1.EmitToImageReference(aliases: ImmutableArray.Create("X")); 3841var libRef = CreateCompilation("", assemblyName: "lib").EmitToImageReference(aliases: ImmutableArray.Create("Alias"));
Compilation\SemanticModelGetSemanticInfoTests.cs (2)
1440var reference1 = BasicCompilationUtils.CompileToMetadata(source1, verify: Verification.Skipped); 1579var reference1 = BasicCompilationUtils.CompileToMetadata(source1, verify: Verification.Skipped);
Compilation\UsedAssembliesTests.cs (146)
74void verify<TAssemblySymbol>(string source2, MetadataReference reference) where TAssemblySymbol : AssemblySymbol 81private void AssertUsedAssemblyReferences(Compilation comp, MetadataReference[] expected, DiagnosticDescription[] before, DiagnosticDescription[] after, MetadataReference[] specificReferencesToAssert) 88void assertUsedAssemblyReferences(Compilation comp, MetadataReference[] expected, DiagnosticDescription[] before, DiagnosticDescription[] after, MetadataReference[] specificReferencesToAssert) 118foreach (var reference in tryRemove) 243private void AssertUsedAssemblyReferences(Compilation comp, params MetadataReference[] expected) 248private void AssertUsedAssemblyReferences(Compilation comp, MetadataReference[] expected, MetadataReference[] specificReferencesToAssert) 253private Compilation AssertUsedAssemblyReferences(string source, MetadataReference[] references, params MetadataReference[] expected) 256private Compilation AssertUsedAssemblyReferences(string source, MetadataReference[] references, MetadataReference[] expected, CSharpParseOptions parseOptions, CSharpCompilationOptions options = null) 263private Compilation AssertUsedAssemblyReferences(string source, params MetadataReference[] references) 268private static void AssertUsedAssemblyReferences(string source, MetadataReference[] references, params DiagnosticDescription[] expected) 287private ImmutableArray<MetadataReference> CompileWithUsedAssemblyReferences(string source, TargetFramework targetFramework, params MetadataReference[] references) 292private ImmutableArray<MetadataReference> CompileWithUsedAssemblyReferences(string source, TargetFramework targetFramework, CSharpCompilationOptions options, params MetadataReference[] references) 304private ImmutableArray<MetadataReference> CompileWithUsedAssemblyReferences(Compilation comp, string expectedOutput = null, MetadataReference[] specificReferencesToAssert = null) 306ImmutableArray<MetadataReference> result = default; 324ImmutableArray<MetadataReference> compileWithUsedAssemblyReferences(Compilation comp, string expectedOutput = null, MetadataReference[] specificReferencesToAssert = null) 336foreach (var reference in tryRemove) 351private ImmutableArray<MetadataReference> CompileWithUsedAssemblyReferences(string source, params MetadataReference[] references) 356private void CompileWithUsedAssemblyReferences(string source, CSharpCompilationOptions options, params MetadataReference[] references) 401void verify<TAssemblySymbol>(string source2, MetadataReference reference) where TAssemblySymbol : AssemblySymbol 435void verify<TAssemblySymbol>(string source2, MetadataReference reference) where TAssemblySymbol : AssemblySymbol 456var comp1ImageRef = comp1.EmitToImageReference(); 487void verify<TAssemblySymbol>(string source2, MetadataReference reference) where TAssemblySymbol : AssemblySymbol 508var comp0ImageRef = comp0.EmitToImageReference(); 522var comp1ImageRef = comp1.EmitToImageReference(); 558void verify<TAssemblySymbol>(string source2, MetadataReference reference0, MetadataReference reference1) where TAssemblySymbol : AssemblySymbol 578var comp0ImageRef = comp0.EmitToImageReference(); 592var comp1Ref = comp1.EmitToImageReference(); 605var comp2ImageRef = comp2.EmitToImageReference(); 656Compilation verify2<TAssemblySymbol>(string source2, MetadataReference reference0, MetadataReference reference1) where TAssemblySymbol : AssemblySymbol 663void verify3<TAssemblySymbol>(string source3, params MetadataReference[] references) where TAssemblySymbol : AssemblySymbol 733void verify(MetadataReference reference, string source) 933void verify(MetadataReference reference0, MetadataReference reference1, string source) 1094void verify(MetadataReference reference0, MetadataReference reference1, string source, bool hasTypeReferencesInUsing = true) 1098AssertUsedAssemblyReferences(comp2, hasTypeReferencesInUsing ? references : new MetadataReference[] { }, references); 1264void verify(MetadataReference reference0, MetadataReference reference1, string source) 1348void verify(MetadataReference reference0, MetadataReference reference1, string source) 1380void verify<TAssemblySymbol>(string source2, MetadataReference reference) where TAssemblySymbol : AssemblySymbol 1452void verify(MetadataReference reference0, MetadataReference reference1, string source) 1632var comp6ImageRef = comp6.EmitToImageReference(); 1636var comp7ImageRef = comp7.EmitToImageReference(embedInteropTypes: false); 1695var comp1ImageRef = comp1.EmitToImageReference(); 1706var comp2ImageRef = comp2.EmitToImageReference(); 1804var comp1ImageRef = comp1.EmitToImageReference(); 1887var comp1ImageRef = comp1.EmitToImageReference(); 1945var comp6ImageRef = comp6.EmitToImageReference(); 1949var comp7ImageRef = comp7.EmitToImageReference(embedInteropTypes: false); 1970var comp1ImageRef = comp1.EmitToImageReference(); 2002void verify<TAssemblySymbol>(string source2, MetadataReference reference) where TAssemblySymbol : AssemblySymbol 2148void verify(MetadataReference reference, string source2) 2315static void verify1(MetadataReference reference, string source, params DiagnosticDescription[] expected) 2337void verify2(MetadataReference reference, string source, string @using) 2402void verify(MetadataReference reference, string source2) 2429var comp0ImageRef = comp0.EmitToImageReference(embedInteropTypes: true); 2442var comp1ImageRef = comp1.EmitToImageReference(); 2462var comp3ImageRef = comp3.EmitToImageReference(embedInteropTypes: false); 2469void verify<TAssemblySymbol>(string source2, MetadataReference reference0, MetadataReference reference1) where TAssemblySymbol : AssemblySymbol 2497var comp0ImageRef = comp0.EmitToImageReference(embedInteropTypes: true); 2509var comp1ImageRef = comp1.EmitToImageReference(); 2513var comp3ImageRef = comp3.EmitToImageReference(embedInteropTypes: false); 2585var comp0ImageRef = comp0.EmitToImageReference(embedInteropTypes: true); 2597var comp1ImageRef = comp1.EmitToImageReference(); 2601var comp3ImageRef = comp3.EmitToImageReference(embedInteropTypes: false); 2673var comp0ImageRef = comp0.EmitToImageReference(embedInteropTypes: true); 2685var comp1ImageRef = comp1.EmitToImageReference(); 2689var comp3ImageRef = comp3.EmitToImageReference(embedInteropTypes: false); 2757var comp0ImageRef = comp0.EmitToImageReference(embedInteropTypes: true); 2770var comp1ImageRef = comp1.EmitToImageReference(); 2774var comp3ImageRef = comp3.EmitToImageReference(embedInteropTypes: false); 2846var comp0ImageRef = comp0.EmitToImageReference(embedInteropTypes: true); 2858var comp1ImageRef = comp1.EmitToImageReference(); 2862var comp3ImageRef = comp3.EmitToImageReference(embedInteropTypes: false); 2934var comp0ImageRef = comp0.EmitToImageReference(embedInteropTypes: true); 2946var comp1ImageRef = comp1.EmitToImageReference(); 2950var comp3ImageRef = comp3.EmitToImageReference(embedInteropTypes: false); 2998var comp0ImageRef = comp0.EmitToImageReference(embedInteropTypes: true); 3037var comp1ImageRef = comp1.EmitToImageReference(); 3041var comp3ImageRef = comp3.EmitToImageReference(embedInteropTypes: false); 3307var comp0ImageRef = comp0.EmitToImageReference(embedInteropTypes: true); 3347var comp1ImageRef = comp1.EmitToImageReference(); 3351var comp3ImageRef = comp3.EmitToImageReference(embedInteropTypes: false); 3535void verifyNotUsed(string source2, MetadataReference ref0, MetadataReference ref1) 3689void verifyDiagnostics(MetadataReference reference0, MetadataReference reference1, string source, params DiagnosticDescription[] diagnostics) 3831void verifyDiagnostics(MetadataReference reference0, MetadataReference reference1, string source, params DiagnosticDescription[] diagnostics) 3838void verify(MetadataReference reference0, MetadataReference reference1, string source) 3915void verify(MetadataReference reference0, MetadataReference reference1, string source) 4020void verify(MetadataReference reference0, MetadataReference reference1, string source, bool hasTypeReferencesInUsing = true) 4024AssertUsedAssemblyReferences(comp2, hasTypeReferencesInUsing ? references : new MetadataReference[] { }, references); 4123void verify(MetadataReference reference0, MetadataReference reference1, string source, bool hasTypeReferencesInUsing = true) 4127AssertUsedAssemblyReferences(comp2, hasTypeReferencesInUsing ? references : new MetadataReference[] { }, references); 4326void verify(MetadataReference reference0, MetadataReference reference1, MetadataReference reference2, string source) 4445void verify(MetadataReference reference0, MetadataReference reference1, MetadataReference reference2, string source) 4552new MetadataReference[] { }, 4581new MetadataReference[] { }, 4623void verify(MetadataReference reference0, MetadataReference reference1, MetadataReference reference2, string source, int namespaceOrdinalReferencedInUsings = 0) 4628AssertUsedAssemblyReferences(comp2, namespaceOrdinalReferencedInUsings switch { 1 => references, 2 => expected, _ => new MetadataReference[] { } }, references); 4772new MetadataReference[] { }, 4806void verify(MetadataReference reference0, MetadataReference reference1, MetadataReference reference2, string source, int namespaceOrdinalReferencedInUsings = 0) 4810AssertUsedAssemblyReferences(comp2, namespaceOrdinalReferencedInUsings switch { 1 => references, 2 => new[] { reference0, reference1 }, 3 => new[] { reference0 }, _ => new MetadataReference[] { } }, references); 4923var comp1ImageRef = comp1.EmitToImageReference(); 5013var comp1ImageRef = comp1.EmitToImageReference(); 5068var comp1ImageRef = comp1.EmitToImageReference(); 5155var comp1ImageRef = comp1.EmitToImageReference(); 5197var comp0ImageRef = comp0.EmitToImageReference(); 5230var comp1ImageRef = comp1.EmitToImageReference(); 5413var comp1ImageRef = comp1.EmitToImageReference(); 5806MetadataReference comp0Ref = comp0.ToMetadataReference(); 5807var comp0RefWithAlias = comp0Ref.WithAliases(new[] { "Alias0" }); 5843MetadataReference comp0Ref = comp0.ToMetadataReference(); 5844var comp0RefWithAlias = comp0Ref.WithAliases(new[] { "Alias0" }); 5878MetadataReference comp0Ref = comp0.ToMetadataReference(); 5879var comp0RefWithAlias = comp0Ref.WithAliases(new[] { "Alias0" }); 5942new MetadataReference[] { }, 5963new MetadataReference[] { },
CrossLanguageTests.cs (1)
31var ref1 = vbcomp.EmitToImageReference(embedInteropTypes: true);
DocumentationComments\CrefTests.cs (3)
1243var ilRef = CompileIL(il); 1865var lib1Ref = CreateCompilation(lib1Source, assemblyName: "A").EmitToImageReference(); 1866var lib2Ref = CreateCompilation(lib2Source, assemblyName: "B").EmitToImageReference();
DocumentationComments\DocumentationCommentCompilerTests.cs (1)
29IEnumerable<MetadataReference> references = null,
SymbolDisplay\SymbolDisplayTests.cs (7)
2852var hostReference = MetadataReference.CreateFromFile(typeof(ScriptGlobals).Assembly.Location); 4561var comp1 = CreateCompilation(src2, references: new MetadataReference[] { compref }, assemblyName: "Comp1"); 4564var mtref = MetadataReference.CreateFromImage(mtdata); 4565var comp2 = CreateCompilation("", references: new MetadataReference[] { mtref }, assemblyName: "Comp2"); 5489var refA = compA.EmitToImageReference(); 5668var refA = compA.EmitToImageReference(); 5693var refA = compA.EmitToImageReference();
Symbols\AccessorOverriddenOrHiddenMembersTests.cs (5)
200var refs = new System.Collections.Generic.List<MetadataReference>() { comp1ref }; 824var refs = new System.Collections.Generic.List<MetadataReference>() { asm01, asm02 }; 869", references: new MetadataReference[] { compref }, assemblyName: "ACCImpGen"); 872var mtref = MetadataReference.CreateFromImage(mtdata); 873var comp2 = CreateCompilation(@"", references: new MetadataReference[] { mtref }, assemblyName: "META");
Symbols\AssemblyAndNamespaceTests.cs (9)
118syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree(text) }, references: new MetadataReference[] { }); 123references: new MetadataReference[] { compRef }); 166references: new MetadataReference[] { compRef }); 208var comp = CreateEmptyCompilation(new string[] { text3 }, references: new MetadataReference[] { compRef1, compRef2 }.ToList(), assemblyName: "Test3"); 251var comp1 = CSharpCompilation.Create(assemblyName: "Test1", options: TestOptions.DebugExe, syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree(text1) }, references: new MetadataReference[] { }); 252var comp2 = CSharpCompilation.Create(assemblyName: "Test2", options: TestOptions.DebugExe, syntaxTrees: new SyntaxTree[] { SyntaxFactory.ParseSyntaxTree(text2) }, references: new MetadataReference[] { }); 259references: new MetadataReference[] { compRef1, compRef2 }); 301references: new MetadataReference[] { }); 413var libRef = libComp.EmitToImageReference(aliases: ImmutableArray.Create("myTask"));
Symbols\CompilationCreationTests.cs (41)
72var c1 = CSharpCompilation.Create("Test", references: new MetadataReference[] { MscorlibRef_v4_0_30316_17626, mdTestLib1 }); 230var asm4 = MetadataTestHelpers.GetSymbolsForReferences(new MetadataReference[] 716new MetadataReference[] { NetFramework.mscorlib, varC_MTTestLib1_V1.ToMetadataReference() }); 725new MetadataReference[] 770new MetadataReference[] { NetFramework.mscorlib }); 803new MetadataReference[] 818new MetadataReference[] 896new MetadataReference[] { NetFramework.mscorlib }); 942new MetadataReference[] { NetFramework.mscorlib, 954new MetadataReference[] 1059new MetadataReference[] { NetFramework.mscorlib, varC_MTTestLib3.ToMetadataReference() }); 1068new MetadataReference[] { NetFramework.mscorlib, varC_MTTestLib2.ToMetadataReference() }); 1077new MetadataReference[] { NetFramework.mscorlib, varC_MTTestLib2.ToMetadataReference(), varC_MTTestLib3.ToMetadataReference(), varC_MTTestLib4.ToMetadataReference() }); 1145new MetadataReference[] { NetFramework.mscorlib, varC_MTTestLib4.ToMetadataReference(), varC_MTTestLib2.ToMetadataReference(), varC_MTTestLib3.ToMetadataReference() }); 1159new MetadataReference[] { NetFramework.mscorlib, varC_MTTestLib4.ToMetadataReference() }); 1168new MetadataReference[] { 1432new MetadataReference[] { 1470new MetadataReference[] 1487new MetadataReference[] 1555new MetadataReference[] 1575new MetadataReference[] { 1680new MetadataReference[] { 1692new MetadataReference[] { 1704new MetadataReference[] { 1781new MetadataReference[] { 1800new MetadataReference[] { 1812new MetadataReference[] { 2107new MetadataReference[] { NetFramework.mscorlib }); 2122new MetadataReference[] { NetFramework.mscorlib }); 2137new MetadataReference[] { NetFramework.mscorlib }); 2152new MetadataReference[] { NetFramework.mscorlib }); 2234new MetadataReference[] { NetFramework.mscorlib, 2254new MetadataReference[] { 2549var c1 = CreateEmptyCompilation(text, new MetadataReference[] 2558var c2 = CreateCompilation(c2_Name, null, new MetadataReference[] 2652return ImmutableArray.Create(MetadataReference.CreateFromFile(_data)); 2655return ImmutableArray.Create(MetadataReference.CreateFromFile(_core)); 2658return ImmutableArray.Create(MetadataReference.CreateFromFile(_system)); 2663return ImmutableArray.Create(MetadataReference.CreateFromFile(reference)); 2764return ImmutableArray.Create(MetadataReference.CreateFromFile(path, properties)); 2973var ref1 = lib1.EmitToImageReference(); // NOTE: can't use a compilation reference for a module.
Symbols\ConversionTests.cs (2)
26var compilation = CSharpCompilation.Create("Test", references: new MetadataReference[] { mscorlibRef }); 300var compilation = CreateCompilation(text, new MetadataReference[] { ilAssemblyReference });
Symbols\CorLibrary\CorTypes.cs (5)
99assemblies = MetadataTestHelpers.GetSymbolsForReferences(mrefs: new[] { MetadataReference.CreateFromImage(Net50.Resources.SystemRuntime) }); 364var comp1Ref = comp1.EmitToImageReference(); 539var comp1Ref = comp1.EmitToImageReference(); 813var comp1Ref = comp1.EmitToImageReference(); 1007var comp1Ref = comp1.EmitToImageReference();
Symbols\CovariantReturnTests.cs (54)
24private static readonly MetadataReference CorelibraryWithCovariantReturnSupport1; 25private static readonly MetadataReference CorelibraryWithCovariantReturnSupport2; 26private static readonly MetadataReference CorelibraryWithoutCovariantReturnSupport1; 27private static readonly MetadataReference CorelibraryWithoutCovariantReturnSupport2; 28private static readonly MetadataReference CorelibraryWithCovariantReturnSupportButWithoutPreserveBaseOverridesAttribute; 398MetadataReference[] references = null, 417MetadataReference[] references = null, 437MetadataReference[] references = null, 457MetadataReference[] references = null, 462var coreLibrary = comp.GetMetadataReference(comp.Assembly.CorLibrary); 478MetadataReference[] references = null, 482var compAsImage = comp.EmitToImageReference(); 484var coreLibrary = comp.GetMetadataReference(comp.Assembly.CorLibrary); 495MetadataReference[] references = null, 503var coreLibrary = comp.GetMetadataReference(comp.Assembly.CorLibrary); 504MetadataReference alternateCorlib = 1413var baseMetadata = CreateCompilationWithCovariantReturns(s0).EmitToImageReference(); 1475var baseMetadata = CreateCompilationWithCovariantReturns(s0).EmitToImageReference(); 1539var baseMetadata = CreateCompilationWithCovariantReturns(s0).EmitToImageReference(); 2578var csRef = csComp.EmitToImageReference(); 2811var ref0 = CreateCompilationWithoutCovariantReturns(s0).EmitToImageReference(); 2818var ref1a = CreateCompilationWithoutCovariantReturns( 2829var ref1b = CreateCompilationWithCovariantReturns( 2905var ref0 = CreateCompilationWithoutCovariantReturns(s0).EmitToImageReference(); 2912var ref1a = CreateCompilationWithoutCovariantReturns(s1a, references: new[] { ref0 }, assemblyName: "ref1").EmitToImageReference(); 2920var ref1b = CreateCompilationWithCovariantReturns(s1b, references: new[] { ref0 }, assemblyName: "ref1").EmitToImageReference(); 2972var ref0 = CreateCompilationWithoutCovariantReturns(s0).EmitToImageReference(); 2979var ref1a = CreateCompilationWithoutCovariantReturns(s1a, references: new[] { ref0 }, assemblyName: "ref1").EmitToImageReference(); 2987var ref1b = CreateCompilationWithCovariantReturns(s1b, references: new[] { ref0 }, assemblyName: "ref1").EmitToImageReference(); 3746MetadataReference ilReference = CreateMetadataReferenceFromIlSource(ilSource, prependDefaultHeader: false); 3825var corlibRef = withCovariantCapableRuntime ? CorelibraryWithCovariantReturnSupport1 : CorelibraryWithoutCovariantReturnSupport1; 3826var corlib2Ref = withCovariantCapableRuntime ? CorelibraryWithCovariantReturnSupport2 : CorelibraryWithoutCovariantReturnSupport2; 3865MetadataReference[] references; 3866MetadataReference[] retargetReferences; 3944var corlibRef = withCovariantCapableRuntime ? CorelibraryWithCovariantReturnSupport1 : CorelibraryWithoutCovariantReturnSupport1; 3945var corlib2Ref = withCovariantCapableRuntime ? CorelibraryWithCovariantReturnSupport2 : CorelibraryWithoutCovariantReturnSupport2; 3988MetadataReference[] references; 3989MetadataReference[] retargetReferences; 4068var corlibRef = withCovariantCapableRuntime ? CorelibraryWithCovariantReturnSupport1 : CorelibraryWithoutCovariantReturnSupport1; 4069var corlib2Ref = withCovariantCapableRuntime ? CorelibraryWithCovariantReturnSupport2 : CorelibraryWithoutCovariantReturnSupport2; 4108MetadataReference[] references; 4109MetadataReference[] retargetReferences; 4183var corlibRef = withCovariantCapableRuntime ? CorelibraryWithCovariantReturnSupport1 : CorelibraryWithoutCovariantReturnSupport1; 4184var corlib2Ref = withCovariantCapableRuntime ? CorelibraryWithCovariantReturnSupport2 : CorelibraryWithoutCovariantReturnSupport2; 4222MetadataReference[] references; 4223MetadataReference[] retargetReferences; 4304var corlibRef = withCovariantCapableRuntime ? CorelibraryWithCovariantReturnSupport1 : CorelibraryWithoutCovariantReturnSupport1; 4305var corlib2Ref = withCovariantCapableRuntime ? CorelibraryWithCovariantReturnSupport2 : CorelibraryWithoutCovariantReturnSupport2; 4331MetadataReference[] references; 4332MetadataReference[] retargetReferences; 4410var corlibRef = withCovariantCapableRuntime ? CorelibraryWithCovariantReturnSupport1 : CorelibraryWithoutCovariantReturnSupport1; 4411var corlib2Ref = withCovariantCapableRuntime ? CorelibraryWithCovariantReturnSupport2 : CorelibraryWithoutCovariantReturnSupport2; 4494MetadataReference[] references; 4495MetadataReference[] retargetReferences;
Symbols\CSharpCompilerFeatureRequiredTests.cs (3)
63protected override CSharpCompilation CreateCompilation(CSharpTestSource source, MetadataReference[] references) 234protected override void AssertModuleErrors(CSharpCompilation comp, MetadataReference ilRef) 392protected override void AssertAssemblyErrors(CSharpCompilation comp, MetadataReference ilRef)
Symbols\DefaultInterfaceImplementationTests.cs (134)
166foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 1676foreach (var reference in new[] { compilation1.EmitToImageReference(), compilation1.ToMetadataReference() }) 1742foreach (var reference in new[] { compilation1.EmitToImageReference(), compilation1.ToMetadataReference() }) 2265foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 2334foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 2407foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 2480foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 9280foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 9470foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 9992foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 11755foreach (var reference in new[] { compilation3.ToMetadataReference(), compilation3.EmitToImageReference() }) 11905foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 12020foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 12143foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 12234foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 12296foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 12358foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 12635foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 12723foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 12811foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 14956foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 15135foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 15261foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 15862foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 18326foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 18492foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 20424foreach (var reference in new[] { compilation3.ToMetadataReference(), compilation3.EmitToImageReference() }) 28499foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 28640foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 28765foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 29374foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 31166foreach (var reference in new[] { compilation3.ToMetadataReference(), compilation3.EmitToImageReference() }) 32022foreach (var reference in new[] { compilation3.ToMetadataReference(), compilation3.EmitToImageReference() }) 32156foreach (var reference in new[] { compilation3.ToMetadataReference(), compilation3.EmitToImageReference() }) 32547foreach (var reference in new[] { compilation3.ToMetadataReference(), compilation3.EmitToImageReference() }) 34461foreach (var ref1 in refs1) 34538foreach (var ref2 in refs2) 35467foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 35576foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 35689foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 35802foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 35908foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 36013foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 36111foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 36225foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 36402foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 36427foreach (var reference in new[] { compilation4.ToMetadataReference(), compilation4.EmitToImageReference() }) 36590foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 36615foreach (var reference in new[] { compilation4.ToMetadataReference(), compilation4.EmitToImageReference() }) 36778foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 36803foreach (var reference in new[] { compilation4.ToMetadataReference(), compilation4.EmitToImageReference() }) 38418foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 38444foreach (var reference in new[] { compilation4.ToMetadataReference(), compilation4.EmitToImageReference() }) 38798foreach (var ref1 in refs1) 38878foreach (var ref2 in refs2) 41460foreach (var ref1 in refs1) 41540foreach (var ref2 in refs2) 42037foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 42064foreach (var reference in new[] { compilation4.ToMetadataReference(), compilation4.EmitToImageReference() }) 42241foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 42268foreach (var reference in new[] { compilation4.ToMetadataReference(), compilation4.EmitToImageReference() }) 42445foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 42472foreach (var reference in new[] { compilation4.ToMetadataReference(), compilation4.EmitToImageReference() }) 44220foreach (var reference in references) 44266foreach (var reference in references) 46032foreach (var reference in new[] { compilation0.ToMetadataReference(), compilation0.EmitToImageReference() }) 46158foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 46301foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 46596MetadataReference metadataReference = compilation1.EmitToImageReference(); 47229MetadataReference metadataReference = compilation1.EmitToImageReference(); 47321MetadataReference metadataReference = compilation1.EmitToImageReference(); 47397MetadataReference metadataReference = compilation1.EmitToImageReference(); 47527MetadataReference metadataReference = compilation1.EmitToImageReference(); 47608MetadataReference metadataReference = compilation1.EmitToImageReference(); 47682MetadataReference metadataReference0 = compilation0.EmitToImageReference(); 47714MetadataReference metadataReference3 = compilation3.EmitToImageReference(); 47743MetadataReference metadataReference6 = compilation6.EmitToImageReference(); 47815MetadataReference metadataReference0 = compilation0.EmitToImageReference(); 47847MetadataReference metadataReference3 = compilation3.EmitToImageReference(); 47876MetadataReference metadataReference6 = compilation6.EmitToImageReference(); 47943MetadataReference metadataReference = compilation1.EmitToImageReference(); 48010MetadataReference metadataReference = compilation1.EmitToImageReference(); 48086MetadataReference metadataReference = compilation1.EmitToImageReference(); 48143MetadataReference metadataReference = compilation1.EmitToImageReference(); 48210MetadataReference metadataReference = compilation1.EmitToImageReference(); 48307MetadataReference metadataReference = compilation1.EmitToImageReference(); 48377MetadataReference metadataReference = compilation1.EmitToImageReference(); 48441MetadataReference metadataReference = compilation1.EmitToImageReference(); 48520MetadataReference metadataReference = compilation1.EmitToImageReference(); 48592MetadataReference metadataReference = compilation1.EmitToImageReference(); 48664MetadataReference metadataReference = compilation1.EmitToImageReference(); 48734MetadataReference metadataReference = compilation1.EmitToImageReference(); 48897MetadataReference metadataReference = compilation1.EmitToImageReference(); 48963MetadataReference metadataReference = compilation1.EmitToImageReference(); 49070MetadataReference metadataReference = compilation1.EmitToImageReference(); 49302MetadataReference metadataReference = compilation1.EmitToImageReference(); 49542MetadataReference metadataReference = compilation1.EmitToImageReference(); 49658foreach (var reference in new[] { compilation1.EmitToImageReference(), compilation1.ToMetadataReference() }) 49774foreach (var reference in new[] { compilation1.EmitToImageReference(), compilation1.ToMetadataReference() }) 50575foreach (var reference in new[] { piaCompilation.ToMetadataReference(embedInteropTypes: true), piaCompilation.EmitToImageReference(embedInteropTypes: true) }) 50620foreach (var reference in new[] { piaCompilation.ToMetadataReference(embedInteropTypes: true), piaCompilation.EmitToImageReference(embedInteropTypes: true) }) 50682IEnumerable<MetadataReference> baseReferences = TargetFrameworkUtil.GetReferencesWithout(TargetFramework.Net50, "System.Runtime.InteropServices.dll"); 50684var attributesRef = attributes.EmitToImageReference(); 50750var pia2Reference = pia2Compilation.EmitToImageReference(); 50755foreach (var reference2 in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 50805foreach (var reference in new[] { piaCompilation.ToMetadataReference(embedInteropTypes: true), piaCompilation.EmitToImageReference(embedInteropTypes: true) }) 51068foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 51235foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 51379foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 51516foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 51663foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 51803foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 51909foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 52508foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 52704foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 52865foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 53032foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 53204foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 53366foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 53501foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 54198foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 57486foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 57662foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 57816foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 57971foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 58130foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 58279foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 58403foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 59250foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 66749foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 66929foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 68189foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 68864foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() }) 68949foreach (var reference in new[] { compilation2.ToMetadataReference(), compilation2.EmitToImageReference() })
Symbols\DestructorTests.cs (1)
525var vbRef = CreateVisualBasicCompilation("VB", vb).EmitToImageReference();
Symbols\EnumTests.cs (4)
321var refA = comp.EmitToImageReference(); 333var refB = comp.EmitToImageReference(); 365var refA = comp.EmitToImageReference(); 377var refB = comp.EmitToImageReference();
Symbols\ErrorTypeSymbolTests.cs (2)
31var reference1 = MetadataReference.CreateFromImage(compilation1.EmitToArray(options: new EmitOptions(metadataOnly: true))); 45var reference2 = MetadataReference.CreateFromImage(compilation2.EmitToArray(options: new EmitOptions(metadataOnly: true)));
Symbols\ExtendedPartialMethodsTests.cs (6)
2092void verify(MetadataReference reference) 2238void verify(MetadataReference reference) 2281void verify(MetadataReference reference) 2324void verify(MetadataReference reference) 2365void verify(MetadataReference reference) 2486void verify(MetadataReference reference)
Symbols\ExtensionMethodTests.cs (4)
3239var reference1 = CompileIL(source1, prependDefaultHeader: false); 3270var reference1 = BasicCompilationUtils.CompileToMetadata(source1, references: new[] { MscorlibRef, SystemCoreRef, MsvbRef }); 3298var reference1 = MetadataReference.CreateFromImage(compilationVerifier.EmittedAssemblyData); 3311var reference2 = MetadataReference.CreateFromImage(compilationVerifier.EmittedAssemblyData);
Symbols\GenericConstraintTests.cs (11)
291var comp2 = CreateCompilation(source, new MetadataReference[] { comp1.EmitToImageReference() }); 2934var compilation2 = CreateCompilation(source2, references: new MetadataReference[] { MetadataReference.CreateFromImage(compilation1.EmitToArray()) }); 2965var compilation3 = CreateCompilation(source3, references: new MetadataReference[] { MetadataReference.CreateFromImage(compilation2.EmitToArray()) }); 3081var compilation2 = CreateCompilation(source2, assemblyName: "d03a3229-eb22-4682-88df-77efaa348e3b", references: new MetadataReference[] { new CSharpCompilationReference(compilation1) }); 3097var compilation3 = CreateCompilation(source3, references: new MetadataReference[] { new CSharpCompilationReference(compilation2) }); 6439var compilation2 = CreateCompilation(source2, references: new MetadataReference[] { new CSharpCompilationReference(compilation1) }); 6443var compilation3 = CreateCompilation(source3, references: new MetadataReference[] { new CSharpCompilationReference(compilation2) }); 6862references: new MetadataReference[] { MetadataReference.CreateFromImage(compilation1.EmitToArray()) },
Symbols\IndexedPropertyTests.cs (33)
47var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 109var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 207var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 290var reference1 = CompileIL(source1); 575var reference1 = CompileIL(source1); 692var reference1 = CompileIL(source1); 848var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 959var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 1074var reference1 = CompileIL(source1); 1173var reference1 = BasicCompilationUtils.CompileToMetadata(source1, verify: Verification.Passes); 1209var reference1 = BasicCompilationUtils.CompileToMetadata(source1, verify: Verification.Passes); 1255var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 1304var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 1353var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 1395var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 1479var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 1541var reference1 = BasicCompilationUtils.CompileToMetadata(source1, verify: Verification.Skipped); 1620var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 1691var reference2 = MetadataReference.CreateFromImage(compilation2.EmittedAssemblyData); 1811var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 1898var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 1957var reference1 = BasicCompilationUtils.CompileToMetadata(source1, verify: Verification.Passes); 2045var reference1 = BasicCompilationUtils.CompileToMetadata(source1, verify: Verification.Passes); 2104var reference1 = BasicCompilationUtils.CompileToMetadata(source1, verify: Verification.Skipped); 2139var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 2163var reference1 = CompileIL(source1); 2179var reference2 = BasicCompilationUtils.CompileToMetadata(source2, references: new[] { MscorlibRef, reference1 }); 2237var reference1 = BasicCompilationUtils.CompileToMetadata(source1, verify: Verification.Passes); 2309var reference1 = BasicCompilationUtils.CompileToMetadata(source1, verify: Verification.Passes); 2386var reference1 = BasicCompilationUtils.CompileToMetadata(source1, verify: Verification.Passes); 2620var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 2693var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 2752var reference1 = BasicCompilationUtils.CompileToMetadata(source1);
Symbols\IndexerTests.cs (3)
1368new MetadataReference[] { TestReferences.SymbolsTests.Indexers }); 1409new MetadataReference[] { TestReferences.SymbolsTests.Indexers }); 2764var reference1 = CompileIL(source1);
Symbols\InterfaceImplementationTests.cs (8)
235var refs = new System.Collections.Generic.List<MetadataReference>() { comp1ref }; 307var refs = new System.Collections.Generic.List<MetadataReference>() { comp1ref }; 421var refs = new System.Collections.Generic.List<MetadataReference>() { comp1ref }; 973references: new MetadataReference[] { new CSharpCompilationReference(comp1) }, 1054var comp = CreateCompilation(text, new MetadataReference[] { ilAssemblyReference }); 2082var ilRef = CompileIL(il); 2698var ref0 = AsReference(comp, useCompilationReference); 2701var ref1 = AsReference(comp, useCompilationReference);
Symbols\Metadata\MetadataMemberTests.cs (5)
153var mscorlib = compilation.ExternalReferences[0]; 188var mscorlib = compilation.ExternalReferences[0]; 240var mscorlib = compilation.ExternalReferences[0]; 300var mscorlib = compilation.ExternalReferences[0]; 345var mscorlib = compilation.ExternalReferences[0];
Symbols\Metadata\MetadataTypeTests.cs (7)
29var mscorlib = compilation.ExternalReferences[0]; 69var mscorlib = compilation.ExternalReferences[0]; 119var mscorlib = compilation.ExternalReferences[0]; 169var mscorlib = compilation.ExternalReferences[0]; 219var mscorlib = compilation.ExternalReferences[0]; 283var compilation2 = CreateEmptyCompilation(source2, new MetadataReference[] { Net40.References.mscorlib, Net40.References.SystemCore, compilation1.EmitToImageReference() }, 286var compilation1Lib = compilation2.ExternalReferences[2];
Symbols\Metadata\PE\BaseTypeResolution.cs (5)
311var c1 = CSharpCompilation.Create("Test", references: new MetadataReference[] { mscorlibRef }); 317var c2 = CSharpCompilation.Create("Test2", references: new MetadataReference[] { localMTTestLib1Ref }); 337var compilation1 = CreateCompilation(compilationDef1, new MetadataReference[] { crossRefLib }, TestOptions.ReleaseDll); 357var compilation2 = CreateCompilation(compilationDef2, new MetadataReference[] { crossRefModule1, crossRefModule2 }, TestOptions.ReleaseDll); 369var compilation3 = CreateCompilation(compilationDef2, new MetadataReference[] { crossRefModule2 }, TestOptions.ReleaseDll);
Symbols\Metadata\PE\DynamicTransformsTests.cs (1)
437var dll = MetadataReference.CreateFromImage(TestResources.MetadataTests.Invalid.InvalidDynamicAttributeArgs.AsImmutableOrNull());
Symbols\Metadata\PE\LoadInAttributeModifier.cs (42)
20var reference = CompileIL(@" 56var reference = CompileIL(@" 101var reference = CompileIL(@" 135var reference = CompileIL(@" 169var reference = CompileIL(@" 211var reference = CompileIL(@" 253var reference = CompileIL(@" 288var reference = CompileIL(@" 323var reference = CompileIL(@" 400var reference = CompileIL(@" 476var reference = CompileIL(@" 553var reference = CompileIL(@" 629var reference = CompileIL(@" 661var reference = CompileIL(@" 693var reference = CompileIL(@" 745var reference = CompileIL(@" 787var reference = CompileIL(@" 829var reference = CompileIL(@" 881var reference = CompileIL(@" 923var reference = CompileIL(@" 965var reference = CompileIL(@" 1025var reference = CompileIL(@" 1071var reference = CompileIL(@" 1117var reference = CompileIL(@" 1177var reference = CompileIL(@" 1223var reference = CompileIL(@" 1269var reference = CompileIL(@" 1413var reference = CompileIL(@" 1556var reference = CompileIL(@" 1669var reference = CompileIL(@" 1778var reference = CompileIL(@" 1881var reference = CompileIL(@" 1980var reference = CompileIL(@" 2124var reference = CompileIL(@" 2267var reference = CompileIL(@" 2380var reference = CompileIL(@" 2489var reference = CompileIL(@" 2592var reference = CompileIL(@" 2691var reference = CompileIL(@" 2738var reference = CompileIL(@" 2785var reference = CompileIL(@" 2824var reference = CompileIL(@"
Symbols\Metadata\PE\LoadingEvents.cs (3)
467var reference = CreateCompilation(source).EmitToImageReference(); 520var ilRef = CompileIL(ilSource); 580var ilRef = CompileIL(ilSource);
Symbols\Metadata\PE\LoadingGenericTypeParameters.cs (1)
197var mdRef = MetadataReference.CreateFromImage(TestResources.MetadataTests.Invalid.InvalidGenericType.AsImmutableOrNull());
Symbols\Metadata\PE\LoadingMethods.cs (5)
1263var longFormRef = MetadataReference.CreateFromImage(TestResources.MetadataTests.Invalid.LongTypeFormInSignature); 1287var lib = MetadataReference.CreateFromImage(TestResources.MetadataTests.Invalid.Signatures.SignatureCycle2); 1307var lib = MetadataReference.CreateFromImage(TestResources.MetadataTests.Invalid.Signatures.TypeSpecInWrongPlace); 1347var ilRef = CompileIL(il, prependDefaultHeader: false); 1370var references = new[] { MetadataReference.CreateFromImage(TestResources.SymbolsTests.Metadata.PublicAndPrivateFlags) };
Symbols\Metadata\PE\NoPia.cs (36)
649var assemblies9 = MetadataTestHelpers.GetSymbolsForReferences(new MetadataReference[] 692var tc1 = CSharpCompilation.Create("Cyclic1", references: new MetadataReference[] { mscorlibRef, cyclic2Ref, piaRef, localTypes1Ref }); 695var tc2 = CSharpCompilation.Create("Cyclic1", references: new MetadataReference[] { mscorlibRef, cyclic2Ref, piaRef, localTypes1Ref }); 762var tc1 = CSharpCompilation.Create("C1", references: new MetadataReference[] { mscorlibRef, pia5Link }); 772var tc2 = CSharpCompilation.Create("C1", references: new MetadataReference[] { mscorlibRef, pia5Ref }); 782var tc3 = CSharpCompilation.Create("C1", references: new MetadataReference[] { mscorlibRef, library2Ref, pia5Link, pia1Ref }); 796var tc4 = CSharpCompilation.Create("C1", references: new MetadataReference[] { mscorlibRef, library2Ref, pia5Ref, pia1Ref }); 812var tc5 = CSharpCompilation.Create("C1", references: new MetadataReference[] { mscorlibRef, library2Ref, pia5Link, pia1Link }); 830var tc6 = CSharpCompilation.Create("C1", references: new MetadataReference[] { mscorlibRef, library2Ref, pia5Link, pia1Ref }); 843var tc7 = CSharpCompilation.Create("C1", references: new MetadataReference[] { mscorlibRef, library2Link, pia5Link, pia1Ref }); 882var tc1 = CSharpCompilation.Create("C1", references: new MetadataReference[] { varmscorlibRef, varCRef, varARef, varBLink }); 888var tc2 = CSharpCompilation.Create("C2", references: new MetadataReference[] { varmscorlibRef, varCRef, varARef, varDRef, varBLink }); 896var tc3 = CSharpCompilation.Create("C3", references: new MetadataReference[] { varmscorlibRef, varCRef, varBLink }); 901var tc4 = CSharpCompilation.Create("C4", references: new MetadataReference[] { varmscorlibRef, varCRef, varARef, varBRef }); 911var tc5 = CSharpCompilation.Create("C5", references: new MetadataReference[] { varmscorlibRef, varCRef, varALink, varBLink }); 922var tc6 = CSharpCompilation.Create("C6", references: new MetadataReference[] { varmscorlibRef, varARef, varBLink, varCLink }); 933var tc7 = CSharpCompilation.Create("C7", references: new MetadataReference[] { varmscorlibRef, varCRef, varARef }); 1122var varC_Library2 = CSharpCompilation.Create("Library2", new[] { Parse(library2Source) }, new MetadataReference[] { mscorlibRef, pia1Ref, pia5Ref }); 1129var tc1 = CSharpCompilation.Create("C1", new SyntaxTree[0], new MetadataReference[] { mscorlibRef, pia5Link }); 1139var tc2 = CSharpCompilation.Create("C1", new SyntaxTree[0], new MetadataReference[] { mscorlibRef, pia5Ref }); 1149var tc3 = CSharpCompilation.Create("C1", new SyntaxTree[0], new MetadataReference[] { mscorlibRef, library2Ref, pia5Link, pia1Ref }); 1163var tc4 = CSharpCompilation.Create("C1", new SyntaxTree[0], new MetadataReference[] { mscorlibRef, library2Ref, pia5Ref, pia1Ref }); 1179var tc5 = CSharpCompilation.Create("C1", new SyntaxTree[0], new MetadataReference[] { mscorlibRef, library2Ref, pia5Link, pia1Link }); 1197var tc6 = CSharpCompilation.Create("C1", new SyntaxTree[0], new MetadataReference[] { mscorlibRef, library2Ref, pia5Link, pia1Ref }); 1210var tc7 = CSharpCompilation.Create("C1", new SyntaxTree[0], new MetadataReference[] { mscorlibRef, library2Link, pia5Link, pia1Ref }); 1277var varC_C = CSharpCompilation.Create("C", references: new MetadataReference[] { mscorlibRef, varARef, varBRef }); 1282var varC_D = CSharpCompilation.Create("D", references: new MetadataReference[] { mscorlibRef }); 1287var tc1 = CSharpCompilation.Create("C1", references: new MetadataReference[] { mscorlibRef, varCRef, varARef, varBLink }); 1293var tc2 = CSharpCompilation.Create("C2", references: new MetadataReference[] { mscorlibRef, varCRef, varARef, varDRef, varBLink }); 1301var tc3 = CSharpCompilation.Create("C3", references: new MetadataReference[] { mscorlibRef, varCRef, varBLink }); 1306var tc4 = CSharpCompilation.Create("C4", references: new MetadataReference[] { mscorlibRef, varCRef, varARef, varBRef }); 1316var tc5 = CSharpCompilation.Create("C5", references: new MetadataReference[] { mscorlibRef, varCRef, varALink, varBLink }); 1327var tc6 = CSharpCompilation.Create("C6", references: new MetadataReference[] { mscorlibRef, varARef, varBLink, varCLink }); 1338var tc7 = CSharpCompilation.Create("C7", references: new MetadataReference[] { mscorlibRef, varCRef, varARef }); 1385var referencePIAImage = compilationPIA.EmitToImageReference(embedInteropTypes: true); 1391var referenceBaseImage = compilationBase.EmitToImageReference();
Symbols\Metadata\PE\NoPiaInstantiationOfGenericClassAndStruct.cs (1)
558references: new MetadataReference[]
Symbols\Metadata\PE\NoPiaLocalHideAndTypeSubstitutionTests.cs (15)
28references: new MetadataReference[] { 74references: new MetadataReference[] 80references: new MetadataReference[] 87references: new MetadataReference[] 123references: new MetadataReference[] { 186references: new List<MetadataReference>() { 223references: new List<MetadataReference>() { 258references: new List<MetadataReference>() { 289references: new List<MetadataReference>() { 317references: new List<MetadataReference>() { 339references: new List<MetadataReference>() { 361references: new List<MetadataReference>() { 426references: new List<MetadataReference>() { new CSharpCompilationReference(localType1, embedInteropTypes: true) }); 431references: new List<MetadataReference>() { 471references: new List<MetadataReference>() {
Symbols\Metadata\PE\TypeForwarders.cs (52)
166var ref1 = CompileIL(il1, prependDefaultHeader: false); 167var ref2 = CompileIL(il2, prependDefaultHeader: false); 168var ref3 = CompileIL(il3, prependDefaultHeader: false); 230var ref1 = CompileIL(il1, prependDefaultHeader: false); 231var ref2 = CompileIL(il2, prependDefaultHeader: false); 303var ref1 = CompileIL(il1, prependDefaultHeader: false); 304var ref2 = CompileIL(il2, prependDefaultHeader: false); 305var ref3 = CompileIL(il3, prependDefaultHeader: false); 401var ref1 = CompileIL(il1, prependDefaultHeader: false); 402var ref2 = CompileIL(il2, prependDefaultHeader: false); 403var ref3 = CompileIL(il3, prependDefaultHeader: false); 404var ref4 = CompileIL(il4, prependDefaultHeader: false); 510var ref1 = CompileIL(il1, prependDefaultHeader: false); 511var ref2 = CompileIL(il2, prependDefaultHeader: false); 512var ref3 = CompileIL(il3, prependDefaultHeader: false); 567var ref1 = CompileIL(il1, prependDefaultHeader: false); 568var ref2 = CompileIL(il2, prependDefaultHeader: false); 631var ref1 = CompileIL(il1, prependDefaultHeader: false); 632var ref2 = CompileIL(il2, prependDefaultHeader: false); 700var ref1 = CompileIL(il1, prependDefaultHeader: false); 701var ref2 = CompileIL(il2, prependDefaultHeader: false); 750var ref1 = CompileIL(il1, prependDefaultHeader: false); 751var ref2 = CompileIL(il2, prependDefaultHeader: false); 800var ref1 = CompileIL(il1, prependDefaultHeader: false); 855var ref1 = CompileIL(il1, prependDefaultHeader: false); 896var ref1 = CompileIL(il1, prependDefaultHeader: false); 943var ref1 = CompileIL(il1, prependDefaultHeader: false); 979var ref1 = CompileIL(il1, prependDefaultHeader: false); 1049var ref1 = CompileIL(il1, prependDefaultHeader: false); 1143var ref1 = CompileIL(il1, prependDefaultHeader: false); 1207var ref1 = CompileIL(il1, prependDefaultHeader: false); 1464var ref1 = MetadataReference.CreateFromImage(verifier1.EmittedAssemblyData); 1538var refA = MetadataReference.CreateFromImage(bitsA); 1619var modRef1 = modCompilation.EmitToImageReference(); 1682var modRef2 = GetILModuleReference(ilSource, prependDefaultHeader: false); 1684appCompilation = CreateCompilation(app, references: new MetadataReference[] { modRef2, new CSharpCompilationReference(forwardedTypesCompilation) }, options: TestOptions.ReleaseDll); 1835var cB_ImageRef = cB.EmitToImageReference(); 1843var cC_v1_ImageRef = cC_v1.EmitToImageReference(); 1849var cA_v2_ImageRef = cA_v2.EmitToImageReference(); 1855var cD_ImageRef = cD.EmitToImageReference(); 1865var ref1 = new MetadataReference[] 1872var ref2 = new MetadataReference[] 1878var ref3 = new MetadataReference[] 1885foreach (var r1 in ref1) 1887foreach (var r2 in ref2) 1889foreach (var r3 in ref3) 1919var refA1 = compA1.EmitToImageReference(aliases: ImmutableArray.Create("A")); 1923var refB1 = compB1.EmitToImageReference(aliases: ImmutableArray.Create("B")); 1946var refBImpl = compBImpl.EmitToImageReference(); 1983var refA1 = compA1.EmitToImageReference(aliases: ImmutableArray.Create("A")); 1987var refB1 = compB1.EmitToImageReference(aliases: ImmutableArray.Create("B")); 2010var refBImpl = compBImpl.EmitToImageReference();
Symbols\MissingSpecialMember.cs (4)
486var corlibRef = CreateEmptyCompilation(corlibSource, parseOptions: parseOptions).EmitToImageReference(expectedWarnings: new[] 492var publicLibRef = CreateEmptyCompilation(string.Format(libSourceTemplate, "public"), new[] { corlibRef }, parseOptions: parseOptions).EmitToImageReference(); 493var internalLibRef = CreateEmptyCompilation(string.Format(libSourceTemplate, "internal"), new[] { corlibRef }, parseOptions: parseOptions).EmitToImageReference(); 512var reference = comp1.EmitToImageReference(expectedWarnings: new[]
Symbols\ModuleInitializers\ModuleInitializersTests.cs (2)
832var ref1 = comp1.EmitToImageReference(); 849var ref2 = comp2.EmitToImageReference();
Symbols\OverriddenOrHiddenMembersTests.cs (29)
736var refs = new System.Collections.Generic.List<MetadataReference>() { comp1ref }; 897var comp = CreateCompilation(text, new MetadataReference[] { ilAssemblyReference }); 1254var refs = new MetadataReference[] { TestReferences.SymbolsTests.Properties }; 1268var refs = new MetadataReference[] { TestReferences.SymbolsTests.Properties }; 1316var refs = new MetadataReference[] { TestReferences.SymbolsTests.Properties }; 1415var refs = new MetadataReference[] { TestReferences.SymbolsTests.Properties }; 1564var refs = new MetadataReference[] { TestReferences.SymbolsTests.Events }; 1614var refs = new MetadataReference[] { TestReferences.SymbolsTests.Events }; 2195", new MetadataReference[] { new CSharpCompilationReference(c1) }); 2238", new MetadataReference[] { new CSharpCompilationReference(c1) }); 2826var ref1 = CompileIL(il); 2865var compilation = CreateEmptyCompilation(text, new MetadataReference[] { MscorlibRef_v20 }); 2900var ref1 = comp1.EmitToImageReference(); 2903var ref2 = comp2.EmitToImageReference(); 2948var ref1 = comp1.EmitToImageReference(); 2951var ref2 = comp2.EmitToImageReference(); 2996var ref1 = comp1.EmitToImageReference(); 2999var ref2 = comp2.EmitToImageReference(); 3043var ref1 = comp1.EmitToImageReference(); 3046var ref2 = comp2.EmitToImageReference(); 3090var ref1 = comp1.EmitToImageReference(); 3093var ref2 = comp2.EmitToImageReference(); 3137var ref1 = comp1.EmitToImageReference(); 3140var ref2 = comp2.EmitToImageReference(); 3209var ref1 = comp1.EmitToImageReference(); 3212var ref2 = comp2.EmitToImageReference(); 3214var ilRef = CompileIL(source3, prependDefaultHeader: false); 3264var ref1 = comp1.EmitToImageReference(); 3267var ref2 = comp2.EmitToImageReference();
Symbols\PartialPropertiesTests.cs (2)
1142var reference = comp.EmitToImageReference(); 1189var reference = comp.EmitToImageReference();
Symbols\PEParameterSymbolTests.cs (1)
61var vbComp = CreateVisualBasicCompilation(@"
Symbols\RequiredMembersTests.cs (19)
22private static CSharpCompilation CreateCompilationWithRequiredMembers(CSharpTestSource source, IEnumerable<MetadataReference>? references = null, CSharpParseOptions? parseOptions = null, CSharpCompilationOptions? options = null, string? assemblyName = null, TargetFramework targetFramework = TargetFramework.Standard) 553MetadataReference baseReference = useMetadataReference ? baseComp.ToMetadataReference() : baseComp.EmitToImageReference(); 650var baseReference = useMetadataReference ? baseComp.ToMetadataReference() : baseComp.EmitToImageReference(); 729var baseReference = useMetadataReference ? baseComp.ToMetadataReference() : baseComp.EmitToImageReference(); 1792var ilRef = CompileIL(il); 2063var baseRef = useMetadataReference ? baseComp.ToMetadataReference() : baseComp.EmitToImageReference(); 2538var baseRef = CompileIL(@base); 2733var ilRef = CompileIL(ShadowingBaseAndDerivedIL); 2752var ilRef = CompileIL(ShadowingBaseAndDerivedIL); 2876var ilRef = CompileIL(il); 3012var ilRef = CompileIL(il); 3220var il = CompileIL(ilSource); 3268var il = CompileIL(ilSource); 3303var il = CompileIL(ilSource); 3350var il = CompileIL(ilSource); 3397var il = CompileIL(ilSource); 3540var ilRef = CompileIL(il); 3674var ilRef = CompileIL(il); 3805var ilRef = CompileIL(il);
Symbols\Retargeting\NoPia.cs (96)
291new MetadataReference[] { MscorlibRef }); 360new MetadataReference[] { 402new MetadataReference[] { 433new MetadataReference[] { TestReferences.SymbolsTests.NoPia.Pia1 }, 477new MetadataReference[] { 490new MetadataReference[] { 526new MetadataReference[] { 555new MetadataReference[] { 585new MetadataReference[] { 617new MetadataReference[] { 627new MetadataReference[] { 661new MetadataReference[] { 703new MetadataReference[] { 734new MetadataReference[] { TestReferences.SymbolsTests.NoPia.Pia1 }, 778new MetadataReference[] { 791new MetadataReference[] { 827new MetadataReference[] { 856new MetadataReference[] { 886new MetadataReference[] { 918new MetadataReference[] { 928new MetadataReference[] { 955references: new MetadataReference[] { new CSharpCompilationReference(Pia1, embedInteropTypes: true) }); 960references: new MetadataReference[] { new CSharpCompilationReference(Pia1, embedInteropTypes: true) }); 965new MetadataReference[] { 1007new MetadataReference[] { 1038new MetadataReference[] { TestReferences.SymbolsTests.NoPia.Pia1 }, 1082new MetadataReference[] { 1095new MetadataReference[] { 1131new MetadataReference[] { 1160new MetadataReference[] { 1190new MetadataReference[] { 1222new MetadataReference[] { 1232new MetadataReference[] { 1263var tc1 = CSharpCompilation.Create("Cyclic1", references: new MetadataReference[] { mscorlibRef, cyclic2Ref, piaRef, localTypes1Ref }); 1266var tc2 = CSharpCompilation.Create("Cyclic1", references: new MetadataReference[] { mscorlibRef, cyclic2Ref, piaRef, localTypes1Ref }); 1289var tc1 = CSharpCompilation.Create("Cyclic1", references: new MetadataReference[] { mscorlibRef, cyclic2Ref, piaRef, localTypes1Ref }); 1292var tc2 = CSharpCompilation.Create("Cyclic1", references: new MetadataReference[] { mscorlibRef, cyclic2Ref, piaRef, localTypes1Ref }); 1314references: new MetadataReference[] { new CSharpCompilationReference(Pia1, embedInteropTypes: true) }); 1319var tc1 = CSharpCompilation.Create("Cyclic1", references: new MetadataReference[] { mscorlibRef, cyclic2Ref, piaRef, localTypes1Ref }); 1322var tc2 = CSharpCompilation.Create("Cyclic1", references: new MetadataReference[] { mscorlibRef, cyclic2Ref, piaRef, localTypes1Ref }); 1341new MetadataReference[] 1362new MetadataReference[] 1412new MetadataReference[] { }, 1420new MetadataReference[] { comp.ToMetadataReference() }, 1457new MetadataReference[] { }, 1465new MetadataReference[] { comp.ToMetadataReference() }, 1533references: new MetadataReference[] { pia.ToMetadataReference(embedInteropTypes: true) }); 1537references: new MetadataReference[] { pia.EmitToImageReference(embedInteropTypes: true) }); 1587references: new MetadataReference[] { pia.ToMetadataReference(embedInteropTypes: true) }); 1591references: new MetadataReference[] { pia.EmitToImageReference(embedInteropTypes: true) }); 1640references: new MetadataReference[] { pia.ToMetadataReference(embedInteropTypes: true) }); 1644references: new MetadataReference[] { pia.EmitToImageReference(embedInteropTypes: true) }); 1682references: new MetadataReference[] { pia.ToMetadataReference(embedInteropTypes: true) }); 1686references: new MetadataReference[] { pia.EmitToImageReference(embedInteropTypes: true) }); 1737references: new MetadataReference[] { pia.ToMetadataReference(embedInteropTypes: true) }); 1741references: new MetadataReference[] { pia.EmitToImageReference(embedInteropTypes: true) }); 1805references: new MetadataReference[] { pia.ToMetadataReference(embedInteropTypes: true), lib.ToMetadataReference() }); 1809references: new MetadataReference[] { pia.EmitToImageReference(embedInteropTypes: true), lib.EmitToImageReference() }); 1850references: new MetadataReference[] { new CSharpCompilationReference(pia).WithEmbedInteropTypes(true) }); 1867references: new MetadataReference[] { MetadataReference.CreateFromImage(pia.EmitToArray()).WithEmbedInteropTypes(true) }); 1894new MetadataReference[] 1915new MetadataReference[] 1938references: new MetadataReference[] { new CSharpCompilationReference(Pia1, embedInteropTypes: true) }); 1944new MetadataReference[] 1965new MetadataReference[] 2018var localTypes2Image = MetadataReference.CreateFromImage(localTypes2.EmitToArray()); 2044var piaImage = MetadataReference.CreateFromImage(pia.EmitToArray()); 2047references: new MetadataReference[] {new CSharpCompilationReference(localTypes2), 2062references: new MetadataReference[] {localTypes2Image, 2077references: new MetadataReference[] {new CSharpCompilationReference(localTypes2), 2092references: new MetadataReference[] {localTypes2Image, 2143var localTypes2Image = MetadataReference.CreateFromImage(localTypes2.EmitToArray()); 2169var piaImage = MetadataReference.CreateFromImage(pia.EmitToArray()); 2172references: new MetadataReference[] {new CSharpCompilationReference(localTypes2), 2187references: new MetadataReference[] {localTypes2Image, 2202references: new MetadataReference[] {new CSharpCompilationReference(localTypes2), 2217references: new MetadataReference[] {localTypes2Image, 2268var localTypes2Image = MetadataReference.CreateFromImage(localTypes2.EmitToArray()); 2294var piaImage = MetadataReference.CreateFromImage(pia.EmitToArray()); 2297references: new MetadataReference[] {new CSharpCompilationReference(localTypes2), 2312references: new MetadataReference[] {localTypes2Image, 2327references: new MetadataReference[] {new CSharpCompilationReference(localTypes2), 2342references: new MetadataReference[] {localTypes2Image, 2404references: new MetadataReference[] { new CSharpCompilationReference(pia, embedInteropTypes: true) }); 2406var piaImage = MetadataReference.CreateFromImage(pia.EmitToArray()); 2409references: new MetadataReference[] {new CSharpCompilationReference(localTypes2), 2424references: new MetadataReference[] {new CSharpCompilationReference(localTypes2), 2476var localTypes2Image = MetadataReference.CreateFromImage(localTypes2.EmitToArray()); 2502var piaImage = MetadataReference.CreateFromImage(pia.EmitToArray()); 2505references: new MetadataReference[] {new CSharpCompilationReference(localTypes2), 2520references: new MetadataReference[] {localTypes2Image, 2535references: new MetadataReference[] {new CSharpCompilationReference(localTypes2), 2550references: new MetadataReference[] {localTypes2Image, 2663foreach (MetadataReference piaRef in new[] { piaCompilation.EmitToImageReference(), piaCompilation.ToMetadataReference() }) 2667foreach (MetadataReference consumer1Ref in new[] { compilation1.EmitToImageReference(), compilation1.ToMetadataReference() })
Symbols\Retargeting\RetargetCustomAttributes.cs (4)
74var compilation2 = CSharpCompilation.Create("C2", references: new MetadataReference[] { NewMsCorLib, c1 }); 160private static MetadataReference OldMsCorLib 168private static MetadataReference NewMsCorLib 299var c2 = CreateEmptyCompilation(source2, new MetadataReference[] { NewMsCorLib, new CSharpCompilationReference(c1) });
Symbols\Retargeting\RetargetCustomModifiers.cs (2)
37CSharpCompilation c2 = CSharpCompilation.Create("C2", references: new MetadataReference[] { newMsCorLib, new CSharpCompilationReference(c1) }); 152CSharpCompilation c2 = CSharpCompilation.Create("C2", references: new[] { (MetadataReference)newMsCorLib, r1 });
Symbols\Retargeting\RetargetExplicitInterfaceImplementation.cs (2)
113new MetadataReference[] 377new MetadataReference[]
Symbols\Retargeting\RetargetingTests.cs (5)
969var ilRef = CompileIL(ilSource); 1048var beforeRetargeting = CreateCompilation(originalIdentity, new[] { corlibSource }, new MetadataReference[0]); 1062var afterRetargeting = CreateCompilation(originalIdentity.WithVersion(new Version(2, 0, 0, 0)), new[] { corlibSource }, new MetadataReference[0]); 1126var beforeRetargeting = CreateCompilation(originalIdentity, new[] { corlibSource }, new MetadataReference[0]); 1139var afterRetargeting = CreateCompilation(originalIdentity.WithVersion(new Version(2, 0, 0, 0)), new[] { corlibSource }, new MetadataReference[0]);
Symbols\Source\BaseClassTests.cs (7)
1031var comp2 = CreateCompilation(text, new MetadataReference[] { ClassAv2, new CSharpCompilationReference(comp) }); 1087var comp2 = CreateCompilation(text, new MetadataReference[] 1156var comp2 = CreateCompilation(text, new MetadataReference[] 1180var comp = CreateCompilation(text, new MetadataReference[] 1213var comp2 = CreateCompilation(text, new MetadataReference[] 1621c2 = CreateCompilation(textB, new[] { MetadataReference.CreateFromImage(metadata1) }); 1894var metadataRef = CreateCompilation(source).EmitToImageReference(embedInteropTypes: true);
Symbols\Source\ClsComplianceTests.cs (21)
495var lib1 = CreateCompilation(libSource1, assemblyName: "lib1", parseOptions: TestOptions.Regular11).EmitToImageReference(); 496var lib2 = CreateCompilation(libSource2, assemblyName: "lib2", parseOptions: TestOptions.Regular11).EmitToImageReference(); 497var lib3 = CreateCompilation(libSource3, assemblyName: "lib3", parseOptions: TestOptions.Regular11).EmitToImageReference(); 561var lib1 = CreateCompilation(libSource1, assemblyName: "lib1", options: TestOptions.UnsafeDebugDll).EmitToImageReference(); 562var lib2 = CreateCompilation(libSource2, assemblyName: "lib2", options: TestOptions.UnsafeDebugDll).EmitToImageReference(); 563var lib3 = CreateCompilation(libSource3, assemblyName: "lib3", options: TestOptions.UnsafeDebugDll).EmitToImageReference(); 643var libCompliant = CreateCompilationWithMscorlib46(libCompliant_cs).EmitToImageReference(); 651var libNotCompliant = CreateCompilationWithMscorlib46(libNotCompliant_cs).EmitToImageReference(); 2366var trueModuleRef = CreateCompilation("[assembly:System.CLSCompliant(true)][module:System.CLSCompliant(true)]", options: TestOptions.ReleaseModule, assemblyName: "true").EmitToImageReference(); 2367var falseModuleRef = CreateCompilation("[assembly:System.CLSCompliant(false)][module:System.CLSCompliant(false)]", options: TestOptions.ReleaseModule, assemblyName: "false").EmitToImageReference(); 2368var noneModuleRef = CreateCompilation("", options: TestOptions.ReleaseModule, assemblyName: "none").EmitToImageReference(); 2401var trueModuleRef = CreateCompilation("[assembly:System.CLSCompliant(true)]", options: TestOptions.ReleaseModule, assemblyName: "true").EmitToImageReference(); 2402var falseModuleRef = CreateCompilation("[assembly:System.CLSCompliant(false)]", options: TestOptions.ReleaseModule, assemblyName: "false").EmitToImageReference(); 2403var noneModuleRef = CreateCompilation("", options: TestOptions.ReleaseModule, assemblyName: "none").EmitToImageReference(); 2434var trueModuleRef = CreateCompilation("[assembly:System.CLSCompliant(true)][module:System.CLSCompliant(true)]", options: TestOptions.ReleaseModule, assemblyName: "true").EmitToImageReference(); 2435var falseModuleRef = CreateCompilation("[assembly:System.CLSCompliant(false)][module:System.CLSCompliant(false)]", options: TestOptions.ReleaseModule, assemblyName: "false").EmitToImageReference(); 3130var moduleRef = CreateCompilation(moduleSource, assemblyName: "module").EmitToImageReference(expectedWarnings: new[] 3459var libRef = CreateCompilation(libSource).EmitToImageReference(); 3646var libRef = CreateCompilation(libSource).EmitToImageReference(); 3708var libRef = CompileIL(libIL, prependDefaultHeader: false); 3756var libRef = CreateCompilation(libSource, assemblyName: "lib").EmitToImageReference();
Symbols\Source\CustomModifierCopyTests.cs (28)
49var comp = CreateCompilation(text, new MetadataReference[] { ilAssemblyReference }); 92var comp = CreateCompilation(text, new MetadataReference[] { ilAssemblyReference }); 143var comp = CreateCompilation(text, new MetadataReference[] { ilAssemblyReference }); 192var comp = CreateCompilation(text, new MetadataReference[] { ilAssemblyReference }); 254var comp = CreateCompilation(text, new MetadataReference[] { ilAssemblyReference }); 319var comp = CreateCompilation(text, new MetadataReference[] { ilAssemblyReference }); 355var comp = CreateCompilation(text, new MetadataReference[] { ilAssemblyReference }); 409var comp = CreateCompilation(text, new MetadataReference[] { ilAssemblyReference }); 518var comp = CreateCompilation(text, new MetadataReference[] { ilAssemblyReference }); 587var comp = CreateCompilation(text, new MetadataReference[] { ilAssemblyReference }); 690var comp = CreateCompilation(text, new MetadataReference[] { ilAssemblyReference }); 723var comp = CreateCompilation(text, new MetadataReference[] { ilAssemblyReference }); 764var comp = CreateCompilation(text, new MetadataReference[] { ilAssemblyReference }); 957var ilRef = CompileIL(il, prependDefaultHeader: false); 1001var ilRef = CompileIL(il, prependDefaultHeader: false); 1131var ilRef = CompileIL(il, prependDefaultHeader: false); 1278var ilRef = CompileIL(il, prependDefaultHeader: false); 1394var ilRef = CompileIL(il, prependDefaultHeader: false); 1434var ilRef = CompileIL(il, prependDefaultHeader: false); 1479var ilRef = CompileIL(il, prependDefaultHeader: false); 1523var ilRef = CompileIL(il, prependDefaultHeader: false); 1578var ilRef = CompileIL(il, prependDefaultHeader: false); 1632var ilRef = CompileIL(il, prependDefaultHeader: false); 1682var ilRef = CompileIL(il, prependDefaultHeader: false); 1767var ilRef = CompileIL(il, prependDefaultHeader: false); 1884var ilRef = CompileIL(il, prependDefaultHeader: false); 1981var ilRef = CompileIL(il, prependDefaultHeader: false); 2083var ilRef = CompileIL(il, prependDefaultHeader: false);
Symbols\Source\EventTests.cs (6)
416var libAssemblyRef = libComp.EmitToImageReference(); 462var libAssemblyRef = libComp.EmitToImageReference(); 536var libAssemblyRef = libComp.EmitToImageReference(); 595var libAssemblyRef = libComp.EmitToImageReference(); 627var libAssemblyRef = libComp.EmitToImageReference(); 2107var reference1 = CompileIL(source1);
Symbols\Source\ExternAliasTests.cs (9)
20private static MetadataReference s_goo1; 21public static MetadataReference Goo1 45private static MetadataReference s_goo2; 46public static MetadataReference Goo2 113references: new MetadataReference[] { MscorlibRef, ExternAliasTests.Goo1, ExternAliasTests.Goo2 }); 231var goo2 = MetadataReference.CreateFromImage(comp.EmitToArray()); 317var goo1Alias = comp.EmitToImageReference(aliases: ImmutableArray.Create("global")); 396var ref1 = comp1.EmitToImageReference(aliases: ImmutableArray.Create("X")); 399var ref2 = comp2.EmitToImageReference(aliases: ImmutableArray.Create("X"));
Symbols\Source\FileModifierTests.cs (1)
4505var reference = useMetadataReference ? comp0.ToMetadataReference() : comp0.EmitToImageReference();
Symbols\Source\MethodTests.cs (4)
758var comp2 = CreateCompilationWithMscorlib461(new string[] { text1 }, new List<MetadataReference>() { compRef1 }, assemblyName: "Test2"); 764var comp = CreateCompilationWithMscorlib461(new string[] { text2 }, new List<MetadataReference>() { compRef1, compRef2 }, assemblyName: "Test3"); 1047var comp2 = CreateCompilation(new string[] { text1 }, new List<MetadataReference>() { compRef1 }, assemblyName: "Test2"); 1053var comp = CreateCompilation(new string[] { text2 }, new List<MetadataReference>() { compRef1, compRef2 }, assemblyName: "Test3");
Symbols\Source\NullablePublicAPITests.cs (4)
463var comp1Emit = comp1.EmitToImageReference(); 468var comp2Emit = comp2.EmitToImageReference(); 1049var comp1Emit = comp1.EmitToImageReference(); 1054var comp2Emit = comp2.EmitToImageReference();
Symbols\Source\PropertyTests.cs (9)
1587var ref0 = CompileIL(ilSource, prependDefaultHeader: false); 2005var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 2077var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 2194var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 2271var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 2306var reference1 = BasicCompilationUtils.CompileToMetadata(source1); 2430var reference1 = CompileIL(source1); 2584private static readonly MetadataReference s_propertiesDll = TestReferences.SymbolsTests.Properties; 2607references: new MetadataReference[] { MscorlibRef });
Symbols\Source\SourcePlusMetadataTests.cs (5)
191var comp2 = CSharpCompilation.Create("Compilation2", references: new MetadataReference[] { ref2, MscorlibRef }); 207var comp2 = CSharpCompilation.Create("Compilation2", references: new MetadataReference[] { ref2, MscorlibRef }); 235var comp2 = CSharpCompilation.Create("Compilation2", references: new MetadataReference[] { ref2, MscorlibRef }); 271var C = MetadataReference.CreateFromImage(comp1.EmitToArray()); 277var B = MetadataReference.CreateFromImage(comp2.EmitToArray());
Symbols\StaticAbstractMembersInInterfacesTests.cs (40)
16190foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 16671foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 16759foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 16851foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 16933foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 17015foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 17086foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 17160foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 17247foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 17346foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 17452foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 19918foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 19992foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 20075foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 20155foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 21283foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 21343foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 21446foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 21566foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 21689foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 21798foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 21900foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 23208foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 24769foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 24884foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 25011foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 25082foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 25895foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 27434foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 27549foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 27677foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 27748foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 28882foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 29507foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 29624foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 29730foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 33094foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 33161foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 33228foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() }) 33295foreach (var reference in new[] { compilation1.ToMetadataReference(), compilation1.EmitToImageReference() })
Symbols\SymbolDistinguisherTests.cs (21)
33var libRef = CreateCompilation(tree, assemblyName: "Metadata").EmitToImageReference(); 98var libRef = MetadataReference.CreateFromImage(libComp.EmitToArray(), filePath: "Metadata.dll"); 138var libRef = MetadataReference.CreateFromImage(libComp.EmitToArray(), filePath: "Metadata.dll"); 158var libRef = CreateCompilation(source, assemblyName: "Metadata").EmitToImageReference(); 182var libRef = CreateCompilation(tree, assemblyName: "Metadata").EmitToImageReference(); 208var libRef = CreateCompilation(tree, assemblyName: "Metadata").EmitToImageReference(); 233var libRef = CreateCompilation(tree, assemblyName: "Metadata", options: TestOptions.UnsafeReleaseDll).EmitToImageReference(); 258var libRef = CreateCompilation(tree, assemblyName: "Metadata").EmitToImageReference(); 280var libRef = CreateCompilation(tree, assemblyName: "Metadata").EmitToImageReference(); 297var libRef = CreateCompilation("public class dynamic { }", assemblyName: "Metadata").EmitToImageReference(); 350var libRef = CreateCompilation(libSource, assemblyName: "Metadata").EmitToImageReference(); 384var libRef = CreateCompilation(libSource, assemblyName: "Metadata").EmitToImageReference(); 418var libRef = CreateCompilation(libSource, assemblyName: "Metadata").EmitToImageReference(); 450var libRef = CreateCompilation(libSource, assemblyName: "Metadata").EmitToImageReference(); 482var libRef = CreateCompilation(libSource, assemblyName: "Metadata").EmitToImageReference(); 511var libRef = CreateCompilation(libSource, assemblyName: "Metadata").EmitToImageReference(); 546var libRef = CreateCompilation(libSource, assemblyName: "Metadata").EmitToImageReference(); 611var libRef = CreateCompilation(libSource, assemblyName: "Metadata").EmitToImageReference(); 648var libRef = CreateCompilation(libSource, assemblyName: "Metadata").EmitToImageReference(); 679var libRef = CreateCompilation(libSource, assemblyName: "Metadata").EmitToImageReference(); 740var ref1 = compilation1.EmitToImageReference();
Symbols\SymbolErrorTests.cs (149)
143var comp = CreateCompilation(text, references: new MetadataReference[] { ref2 }, assemblyName: "Test3"); 5494var comp = CreateCompilation(text, new List<MetadataReference> { ref1, ref2 }); 5516comp = CreateCompilation(new SyntaxTree[] { Parse(text, "goo.cs") }, new List<MetadataReference> { ref1 }); 5552var comp = DiagnosticsUtils.VerifyErrorsAndGetCompilationWithMscorlib(text, new List<MetadataReference> { ref1, ref2 }, 5588new List<MetadataReference>() 5627new List<MetadataReference>() 5672new List<MetadataReference>() 5686new List<MetadataReference>() 5690MetadataReference.CreateFromImage(lib.EmitToArray()) 5734new List<MetadataReference>() 5747new List<MetadataReference>() 5750MetadataReference.CreateFromImage(lib.EmitToArray()) 5793new List<MetadataReference>() 5807new List<MetadataReference>() 5811MetadataReference.CreateFromImage(lib.EmitToArray()) 5855new List<MetadataReference>() 5868new List<MetadataReference>() 5871MetadataReference.CreateFromImage(lib.EmitToArray()) 5914new List<MetadataReference>() 5926new List<MetadataReference>() 5929MetadataReference.CreateFromImage(lib.EmitToArray()) 5971new List<MetadataReference>() 5984new List<MetadataReference>() 5987MetadataReference.CreateFromImage(lib.EmitToArray()) 6030new List<MetadataReference>() 6043new List<MetadataReference>() 6046MetadataReference.CreateFromImage(lib.EmitToArray()) 6089new List<MetadataReference>() 6102new List<MetadataReference>() 6105MetadataReference.CreateFromImage(lib.EmitToArray()) 6136new List<MetadataReference>() 6172new List<MetadataReference>() 6208new List<MetadataReference>() 6244new List<MetadataReference>() 6287new List<MetadataReference>() 6300new List<MetadataReference>() 6303MetadataReference.CreateFromImage(lib.EmitToArray()) 6347new List<MetadataReference>() 6361new List<MetadataReference>() 6365MetadataReference.CreateFromImage(lib.EmitToArray()) 6409new List<MetadataReference>() 6422new List<MetadataReference>() 6425MetadataReference.CreateFromImage(lib.EmitToArray()) 6469new List<MetadataReference>() 6483new List<MetadataReference>() 6487MetadataReference.CreateFromImage(lib.EmitToArray()) 6534new List<MetadataReference>() 6547new List<MetadataReference>() 6550MetadataReference.CreateFromImage(lib.EmitToArray()) 6597new List<MetadataReference>() 6610new List<MetadataReference>() 6613MetadataReference.CreateFromImage(lib.EmitToArray()) 6660new List<MetadataReference>() 6677new List<MetadataReference>() 6681MetadataReference.CreateFromImage(lib.EmitToArray()) 6731new List<MetadataReference>() 6744new List<MetadataReference>() 6747MetadataReference.CreateFromImage(lib.EmitToArray()) 6794new List<MetadataReference>() 6810new List<MetadataReference>() 6813MetadataReference.CreateFromImage(lib.EmitToArray()) 6863new List<MetadataReference>() 6880new List<MetadataReference>() 6884MetadataReference.CreateFromImage(lib.EmitToArray()) 6911var mod3Ref = CreateCompilation(mod3Source, options: TestOptions.ReleaseModule, assemblyName: "ErrTestMod03").EmitToImageReference(); 6928new List<MetadataReference>() 6945new List<MetadataReference>() 6964new List<MetadataReference>() 6996var mod3Ref = CreateCompilation(mod3Source, options: TestOptions.ReleaseModule, assemblyName: "ErrTestMod03").EmitToImageReference(); 7013new List<MetadataReference>() 7027new List<MetadataReference>() 7043new List<MetadataReference>() 7067var ModuleA01Ref = CreateCompilation(ModuleA01, options: TestOptions.ReleaseModule, assemblyName: "ModuleA01").EmitToImageReference(); 7075var ModuleB01Ref = CreateCompilation(ModuleB01, options: TestOptions.ReleaseModule, assemblyName: "ModuleB01").EmitToImageReference(); 7088new List<MetadataReference>() 7143new List<MetadataReference>() 7229var moduleRef2 = CreateCompilation(mod2Source, options: TestOptions.ReleaseModule, assemblyName: "mod_1_2").EmitToImageReference(); 7232new List<MetadataReference>() 7271var forwardedTypesModRef = CreateCompilation(forwardedTypesSource, 7282var module1_FT1_Ref = CreateCompilation(modSource, 7285references: new MetadataReference[] { forwardedTypes1Ref }). 7288var module2_FT1_Ref = CreateCompilation(modSource, 7291references: new MetadataReference[] { forwardedTypes1Ref }). 7294var module3_FT2_Ref = CreateCompilation(modSource, 7297references: new MetadataReference[] { forwardedTypes2Ref }). 7300var module4_Ref = CreateCompilation("[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(CF3<int>))]", 7303references: new MetadataReference[] { forwardedTypes1Ref }). 7307new List<MetadataReference>() 7320new List<MetadataReference>() 7330new List<MetadataReference>() 7339new List<MetadataReference>() 7359new List<MetadataReference>() 7372new List<MetadataReference>() 7386new List<MetadataReference>() 7400new List<MetadataReference>() 7410new List<MetadataReference>() 10076var reference1 = CompileIL(source1); 10126var reference1 = CompileIL(source1); 10855var reference1 = CompileIL(source1); 12548var reference1 = CompileIL(source1); 13826var comp2 = CreateCompilation(text2, new MetadataReference[] { compRef1 }); 14836var reference = SystemCoreRef; 14838new List<MetadataReference> { reference }, 16208CreateCompilation(text, references: new MetadataReference[] { ref1 }).VerifyDiagnostics( 16438var ref1 = vbcomp.EmitToImageReference(embedInteropTypes: true); 17637var comp = CreateCompilation(new[] { text }, new List<MetadataReference> { ref1 }); 17675var comp = CreateCompilation(new[] { text }, new List<MetadataReference> { ref1 }); 17742var lib = CreateCompilation(tree, new MetadataReference[] 17823var lib = CreateCompilation(tree, new MetadataReference[] 17918var comp = CreateCompilation(new[] { text }, new List<MetadataReference> { ref1 }); 19084var netModule = CreateEmptyCompilation("", options: TestOptions.ReleaseModule, assemblyName: "lib").EmitToImageReference(expectedWarnings: new[] { Diagnostic(ErrorCode.WRN_NoRuntimeMetadataVersion) }); 20540var ilReference = CompileIL(forwardingIL, prependDefaultHeader: false); 20557references: new MetadataReference[] { ilReference }, 20683var referenceC = CreateCompilation(codeC, assemblyName: "C").EmitToImageReference(); 20698var referenceB = CreateCompilation(codeB, references: new MetadataReference[] { referenceC }, assemblyName: "B").EmitToImageReference(); 20714CreateCompilation(codeA, references: new MetadataReference[] { referenceB, referenceC }, assemblyName: "A").VerifyDiagnostics(); // No Errors 20730var referenceC2 = CompileIL(codeC2, prependDefaultHeader: false); 20732CreateCompilation(codeA, references: new MetadataReference[] { referenceB, referenceC2 }, assemblyName: "A").VerifyDiagnostics( 20747var referenceC = CreateCompilation(codeC, assemblyName: "C").EmitToImageReference(); 20762var referenceB = CreateCompilation(codeB, references: new MetadataReference[] { referenceC }, assemblyName: "B").EmitToImageReference(); 20780references: new MetadataReference[] { referenceB, referenceC }, 20798var referenceC2 = CompileIL(codeC2, prependDefaultHeader: false); 20800CreateCompilation(codeA, references: new MetadataReference[] { referenceB, referenceC2 }).VerifyDiagnostics( 20810var referenceD = CreateCompilation(codeD, assemblyName: "D").EmitToImageReference(); 20815references: new MetadataReference[] { referenceB, referenceC2, referenceD }, 20847var ilModule = GetILModuleReference(ilSource, prependDefaultHeader: false); 20848CreateCompilation(string.Empty, references: new MetadataReference[] { ilModule }, assemblyName: "Forwarder").VerifyDiagnostics( 20867var ilModule = GetILModuleReference(ilSource, prependDefaultHeader: false); 20868CreateCompilation(string.Empty, references: new MetadataReference[] { ilModule }).VerifyDiagnostics( 20877var dReference = CreateCompilation(dCode, assemblyName: "D").EmitToImageReference(); 20880CreateCompilation(string.Empty, references: new MetadataReference[] { ilModule, dReference }).VerifyDiagnostics(); 20901var ilModuleReference = GetILModuleReference(ilSource, prependDefaultHeader: false); 20904references: new MetadataReference[] { ilModuleReference }, 20922references: new MetadataReference[] { forwarderCompilation.ToMetadataReference() }, 20950var module1Reference = GetILModuleReference(module1IL, prependDefaultHeader: false); 20965var module2Reference = GetILModuleReference(module2IL, prependDefaultHeader: false); 20969references: new MetadataReference[] { module1Reference, module2Reference }, 20987references: new MetadataReference[] { forwarderCompilation.ToMetadataReference() }, 21011var referenceC = CreateCompilation(codeC, assemblyName: "C").EmitToImageReference(); 21026var referenceB = CreateCompilation(codeB, references: new MetadataReference[] { referenceC }, assemblyName: "B").EmitToImageReference(); 21042var referenceC2 = CompileIL(codeC2, prependDefaultHeader: false); 21052var referenceD = CompileIL(codeD, prependDefaultHeader: false); 21053var referenceE = CreateCompilation(codeC, assemblyName: "E").EmitToImageReference(); 21070CreateCompilation(codeA, references: new MetadataReference[] { referenceB, referenceC2, referenceD, referenceE }, assemblyName: "A").VerifyDiagnostics( 21576var comp2Ref = comp2.EmitToImageReference(); 21671var comp2Ref = comp2.EmitToImageReference();
Symbols\TypeResolutionTests.cs (4)
66references: new MetadataReference[] 76references: new MetadataReference[] 89references: new MetadataReference[] 122MetadataReference.CreateFromImage(File.ReadAllBytes(typeof(TypeTests).GetTypeInfo().Assembly.Location))
Symbols\TypeTests.cs (8)
194references: new List<MetadataReference> { compRef1 }); 198references: new List<MetadataReference> { compRef2, compRef1 }); 380var comp = CreateCompilation(text1, references: new List<MetadataReference> { compRef1 }, assemblyName: "Comp2"); 399comp = CreateCompilation(text1, references: new List<MetadataReference> { compRef1 }, assemblyName: "Comp2"); 418comp = CreateCompilation(text1, references: new List<MetadataReference> { compRef1 }, assemblyName: "Comp2"); 441comp = CreateCompilation(text1, references: new List<MetadataReference> { compRef1 }, assemblyName: "Comp2"); 804var sysConsoleRef = CreateEmptyCompilation( 1437var r = MetadataReference.CreateFromImage(TestResources.SymbolsTests.Methods.CSMethods.AsImmutableOrNull());
Symbols\UnsignedRightShiftTests.cs (4)
3443foreach (var reference in new[] { compilation0.ToMetadataReference(), compilation0.EmitToImageReference() }) 3495foreach (var reference in new[] { compilation0.ToMetadataReference(), compilation0.EmitToImageReference() }) 3547foreach (var reference in new[] { compilation0.ToMetadataReference(), compilation0.EmitToImageReference() }) 3599foreach (var reference in new[] { compilation0.ToMetadataReference(), compilation0.EmitToImageReference() })
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (1)
Syntax\FieldAndValueKeywordTests.cs (1)
1210var refA = comp.EmitToImageReference();
Microsoft.CodeAnalysis.CSharp.Test.Utilities (71)
BasicCompilationUtils.cs (4)
19public static MetadataReference CompileToMetadata(string source, string assemblyName = null, IEnumerable<MetadataReference> references = null, Verification verify = default) 27return MetadataReference.CreateFromImage(verifier.EmittedAssemblyData); 30private static VisualBasicCompilation CreateCompilationWithMscorlib(string source, string assemblyName, IEnumerable<MetadataReference> references)
CSharpTestBase.cs (52)
662protected static MetadataReference RefSafetyRulesAttributeLib => 799IEnumerable<MetadataReference> references = null, 835IEnumerable<MetadataReference> references = null, 872IEnumerable<MetadataReference> references = null, 913IEnumerable<MetadataReference> references = null, 949IEnumerable<MetadataReference> references = null, 985IEnumerable<MetadataReference> references = null, 1121IEnumerable<MetadataReference> references = null, 1130IEnumerable<MetadataReference> references = null, 1135MetadataReference ilReference = CompileIL(ilSource, appendDefaultHeader); 1142IEnumerable<MetadataReference> references = null, 1150IEnumerable<MetadataReference> references = null, 1159IEnumerable<MetadataReference> references = null, 1168IEnumerable<MetadataReference> references = null, 1177IEnumerable<MetadataReference> references = null, 1186IEnumerable<MetadataReference> references = null, 1194IEnumerable<MetadataReference> references = null, 1202IEnumerable<MetadataReference> references = null, 1210IEnumerable<MetadataReference> references = null, 1218IEnumerable<MetadataReference> references = null, 1226IEnumerable<MetadataReference> references = null, 1239IEnumerable<MetadataReference> references = null, 1245IEnumerable<MetadataReference> allReferences; 1266IEnumerable<MetadataReference> references = null, 1279IEnumerable<MetadataReference> references = null, 1289IEnumerable<MetadataReference> references, 1399static void assertSubset(ImmutableArray<MetadataReference> used, IEnumerable<MetadataReference> resolvedReferences) 1401foreach (var reference in used) 1438IEnumerable<MetadataReference> references, 1455IEnumerable<MetadataReference> references = null, 1474private static readonly ImmutableArray<MetadataReference> s_scriptRefs = ImmutableArray.Create(MscorlibRef_v4_0_30316_17626); 1478IEnumerable<MetadataReference> references = null, 1512MetadataReference reference = CreateMetadataReferenceFromIlSource(ilSource); 1520public static MetadataReference CreateMetadataReferenceFromIlSource(string ilSource, bool prependDefaultHeader = true) 1524return MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)); 2146MetadataReference[] references = null, 2167MetadataReference[] references = null, 2185MetadataReference[] references = null, 2204MetadataReference[] references = null, 2225MetadataReference[] references = null) 2237protected static MetadataReference VerifyOperationTreeAndDiagnosticsForTestWithIL<TSyntaxNode>(string testSrc, 2243MetadataReference[] references = null, 2248var ilReference = CreateMetadataReferenceFromIlSource(ilSource); 2278references: new List<MetadataReference>() { NetFramework.mscorlib, NetFramework.SystemCore, NetFramework.MicrosoftCSharp }, 2285references: new List<MetadataReference>() { NetFramework.mscorlib, NetFramework.SystemCore, NetFramework.MicrosoftCSharp, reference.EmitToImageReference() }, 2297references: new List<MetadataReference>() { MscorlibRef_v4_0_30316_17626, SystemCoreRef, CSharpRef }, 2312references: new List<MetadataReference>() { reference.EmitToImageReference() }, 2323references: new List<MetadataReference>() { reference.EmitToImageReference() }, 2334references: new List<MetadataReference>() { reference.EmitToImageReference() }, 2351references: new List<MetadataReference>() { reference.EmitToImageReference() }, 2369references: new List<MetadataReference>() { reference.EmitToImageReference() },
DiagnosticTestUtilities.cs (4)
56protected internal static CSharpCompilation VerifyErrorsAndGetCompilationWithMscorlib(string text, IEnumerable<MetadataReference> refs, params ErrorDescription[] expectedErrorDesp) 64protected internal static CSharpCompilation VerifyErrorsAndGetCompilationWithMscorlib(List<string> srcs, IEnumerable<MetadataReference> refs, params ErrorDescription[] expectedErrorDesp) 75protected internal static CSharpCompilation VerifyErrorsAndGetCompilationWithMscorlib(SyntaxTree[] trees, IEnumerable<MetadataReference> refs, params ErrorDescription[] expectedErrorDesp) 83protected internal static CSharpCompilation VerifyErrorsAndGetCompilation(IEnumerable<SyntaxTree> synTrees, IEnumerable<MetadataReference> refs = null, params ErrorDescription[] expectedErrorDesp)
Extensions.cs (2)
27public static AssemblySymbol GetReferencedAssemblySymbol(this CSharpCompilation compilation, MetadataReference reference) 32public static ModuleSymbol GetReferencedModuleSymbol(this CSharpCompilation compilation, MetadataReference reference)
MetadataTestHelpers.cs (6)
26internal static AssemblySymbol GetSymbolForReference(MetadataReference reference) 31internal static AssemblySymbol[] GetSymbolsForReferences(params MetadataReference[] mrefs) 36internal static AssemblySymbol[] GetSymbolsForReferences(MetadataReference[] mrefs, Compilation[] compilations) 45MetadataReference[] mrefs = null, 48var refs = new List<MetadataReference>(); 62refs.Add(MetadataReference.CreateFromImage(b.AsImmutableOrNull()));
MockCSharpCompiler.cs (3)
21private readonly ImmutableArray<MetadataReference> _additionalReferences; 27public MockCSharpCompiler(string responseFile, string workingDirectory, string[] args, ImmutableArray<DiagnosticAnalyzer> analyzers = default, ImmutableArray<ISourceGenerator> generators = default, AnalyzerAssemblyLoader loader = null, ImmutableArray<MetadataReference> additionalReferences = default) 32public MockCSharpCompiler(string responseFile, BuildPaths buildPaths, string[] args, ImmutableArray<DiagnosticAnalyzer> analyzers = default, ImmutableArray<ISourceGenerator> generators = default, AnalyzerAssemblyLoader loader = null, GeneratorDriverCache driverCache = null, ImmutableArray<MetadataReference> additionalReferences = default)
Microsoft.CodeAnalysis.CSharp.WinRT.UnitTests (38)
CodeGen\WinMdEventTests.cs (1)
627var comp2 = CreateEmptyCompilation(source2, WinRtRefs.Concat(new MetadataReference[] { new CSharpCompilationReference(comp1), serializationRef, SystemXmlRef }), TestOptions.ReleaseExe);
CodeGen\WinRTCollectionTests.cs (1)
20public static MetadataReference[] LegacyRefs
Metadata\WinMdDumpTest.cs (14)
26private readonly MetadataReference _windowsRef = MetadataReference.CreateFromImage(TestResources.WinRt.Windows.AsImmutableOrNull()); 27private readonly MetadataReference _systemRuntimeRef = MetadataReference.CreateFromImage(Net461.Resources.SystemRuntime.AsImmutableOrNull()); 28private readonly MetadataReference _systemObjectModelRef = MetadataReference.CreateFromImage(Net461.Resources.SystemObjectModel.AsImmutableOrNull()); 29private readonly MetadataReference _windowsRuntimeUIXamlRef = MetadataReference.CreateFromImage(TestResources.NetFX.WinRt.SystemRuntimeWindowsRuntimeUIXaml.AsImmutableOrNull()); 30private readonly MetadataReference _interopServicesWindowsRuntimeRef = MetadataReference.CreateFromImage(Net461.Resources.SystemRuntimeInteropServicesWindowsRuntime.AsImmutableOrNull()); 435private string Dump(MetadataReference winmd, MetadataReference[] additionalRefs = null) 437IEnumerable<MetadataReference> references = new[] { MscorlibRef_v4_0_30316_17626, _systemRuntimeRef, _systemObjectModelRef, _windowsRuntimeUIXamlRef, _interopServicesWindowsRuntimeRef, winmd }; 476var winmd = MetadataReference.CreateFromImage(TestResources.WinRt.WinMDPrefixing.AsImmutableOrNull());
Metadata\WinMdEventTests.cs (15)
175private readonly MetadataReference _eventLibRef; 315var dynamicCommonRef = dynamicCommon.EmitToImageReference(expectedWarnings: new[] 2747var winmdlib = comp.ExternalReferences.Where(r => r.Display == "Windows").Single(); 2838var ilRef = CompileIL(il); 2954var ilRef = CompileIL(EventInterfaceIL); 3022var interfaceILRef = CompileIL(EventInterfaceIL); 3023var baseILRef = CompileIL(EventBaseIL); 3089var ilRef = CompileIL(EventInterfaceIL); 3163var ilRef = CompileIL(il); 3190var ilRef = CompileIL(il); 3215var interfaceILRef = CompileIL(EventInterfaceIL); 3216var baseILRef = CompileIL(EventBaseIL); 3246var interfaceILRef = CompileIL(EventInterfaceIL); 3247var baseILRef = CompileIL(EventBaseIL); 3555var ilRef = CompileIL(ilSource);
Metadata\WinMdMetadataTests.cs (6)
46var winmdlib = comp.ExternalReferences.Where(r => r.Display == "Windows").Single(); 68var winmdlib = comp.ExternalReferences.Where(r => r.Display == "Windows").Single(); 89var winmdlib = comp.ExternalReferences.Where(r => r.Display == "Windows").Single(); 109var winmdlib = comp.ExternalReferences.Where(r => r.Display == "Windows").Single(); 129var winmdlib = comp.ExternalReferences.Where(r => r.Display == "Windows").Single(); 171var winmdlib = comp.ExternalReferences.Where(r => r.Display == "Windows").Single();
WinRTUtil.cs (1)
18MetadataReference[] additionalRefs = null,
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (2)
CodeGeneration\AddImportsTests.cs (2)
774var otherAssemblyReference = GetInMemoryAssemblyReferenceForCode(externalCode); 831private static MetadataReference GetInMemoryAssemblyReferenceForCode(string code)
Microsoft.CodeAnalysis.EditorFeatures (6)
Interactive\InteractiveSession.cs (4)
162var references = ImmutableArray<MetadataReference>.Empty; 165var initializationScriptReferences = ImmutableArray<MetadataReference>.Empty; 187(path, metadataService) => (MetadataReference)metadataService.GetReference(path, MetadataReferenceProperties.Assembly), 255private Project CreateSubmissionProjectNoLock(Solution solution, ProjectId newSubmissionProjectId, ProjectId? previousSubmissionProjectId, string languageName, ImmutableArray<string> imports, ImmutableArray<MetadataReference> references)
Preview\AbstractPreviewFactoryService.cs (2)
156foreach (var metadataReference in projectChanges.GetAddedMetadataReferences()) 163foreach (var metadataReference in projectChanges.GetRemovedMetadataReferences())
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (5)
Semantics\SpeculationAnalyzerTestsBase.cs (1)
21protected readonly MetadataReference[] References =
Workspaces\EditorTestHostProject.cs (3)
20IList<MetadataReference>? references, 57IEnumerable<MetadataReference>? metadataReferences = null, 85IEnumerable<MetadataReference>? metadataReferences = null,
Workspaces\EditorTestWorkspace.cs (1)
82IList<MetadataReference>? references,
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (8)
Diagnostics\SuppressMessageAttributeWorkspaceTests.cs (1)
27private static readonly Lazy<MetadataReference> _unconditionalSuppressMessageRef = new(() =>
MetadataAsSource\AbstractMetadataAsSourceTests.cs (2)
82var references = new List<MetadataReference>(); 88references.Add(MetadataReference.CreateFromImage((await metadataProject.GetCompilationAsync()).EmitToArray()));
MetadataAsSource\AbstractMetadataAsSourceTests.TestContext.cs (1)
176foreach (var reference in compilation.References)
SymbolFinder\DependentTypeFinderTests.cs (1)
27private static Solution AddProjectWithMetadataReferences(Solution solution, string projectName, string languageName, string code, MetadataReference metadataReference, params ProjectId[] projectReferences)
Utilities\SymbolEquivalenceComparerTests.cs (3)
1825MetadataReference r1, r2; 1829r1 = MetadataReference.CreateFromImage(bytes); 1830r2 = MetadataReference.CreateFromImage(bytes);
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (16)
EEMetadataReferenceResolver.cs (7)
14private readonly IReadOnlyDictionary<string, ImmutableArray<(AssemblyIdentity Identity, MetadataReference Reference)>> _referencesBySimpleName; 23IReadOnlyDictionary<string, ImmutableArray<(AssemblyIdentity Identity, MetadataReference Reference)>> referencesBySimpleName) 31public override PortableExecutableReference? ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity) 33(AssemblyIdentity? Identity, MetadataReference? Reference) result = default; 57private (AssemblyIdentity? Identity, MetadataReference? Reference) GetBestMatch( 58ImmutableArray<(AssemblyIdentity Identity, MetadataReference Reference)> references, 61(AssemblyIdentity? Identity, MetadataReference? Reference) best = default;
MetadataUtilities.cs (9)
26internal static ImmutableArray<MetadataReference> MakeAssemblyReferences( 31out IReadOnlyDictionary<string, ImmutableArray<(AssemblyIdentity, MetadataReference)>>? referencesBySimpleName) 118ImmutableArray<MetadataReference> references; 122var refsBySimpleName = new Dictionary<string, ImmutableArray<(AssemblyIdentity, MetadataReference)>>(StringComparer.OrdinalIgnoreCase); 123MetadataReference? targetReference = null; 138refs = ImmutableArray<(AssemblyIdentity, MetadataReference)>.Empty; 150var referencesBuilder = ArrayBuilder<MetadataReference>.GetInstance(); 172var referencesBuilder = ArrayBuilder<MetadataReference>.GetInstance(); 266ArrayBuilder<MetadataReference> modules,
Microsoft.CodeAnalysis.Features (15)
AddImport\AbstractAddImportFeatureService.cs (1)
327foreach (var reference in p.MetadataReferences)
AddImport\SymbolReferenceFinder_PackageAssemblySearch.cs (1)
141foreach (var reference in project.MetadataReferences)
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (1)
115var allAddedMetaDataReferences = new HashSet<MetadataReference>();
DecompiledSource\IDecompilationService.cs (1)
15Document? PerformDecompilation(Document document, string fullName, Compilation compilation, MetadataReference? metadataReference, string? assemblyLocation);
DecompiledSource\IDecompiledSourceService.cs (1)
27Task<Document?> AddSourceToAsync(Document document, Compilation symbolCompilation, ISymbol symbol, MetadataReference? metadataReference, string? assemblyLocation, SyntaxFormattingOptions? formattingOptions, CancellationToken cancellationToken);
DesignerAttribute\DesignerAttributeDiscoveryService.cs (1)
66foreach (var reference in project.MetadataReferences)
MetadataAsSource\DecompilationMetadataAsSourceFileProvider.cs (2)
232private (MetadataReference? metadataReference, string? assemblyLocation, bool isReferenceAssembly) GetReferenceInfo(Compilation compilation, IAssemblySymbol containingAssembly) 234var metadataReference = compilation.GetMetadataReference(containingAssembly);
MetadataAsSource\MetadataAsSourceGeneratedFileInfo.cs (1)
22public readonly ImmutableArray<MetadataReference> References;
MetadataAsSource\MetadataAsSourceHelpers.cs (1)
47var assemblyReference = compilation.GetMetadataReference(assemblySymbol);
PdbSourceDocument\PdbSourceDocumentMetadataAsSourceFileProvider.cs (1)
147var dllReference = IOUtilities.PerformIO(() => MetadataReference.CreateFromFile(dllPath, documentation: documentationProvider.GetDocumentationProvider(dllPath)));
SemanticSearch\AbstractSemanticSearchService.cs (1)
58protected abstract Compilation CreateCompilation(SourceText query, IEnumerable<MetadataReference> references, SolutionServices services, out SyntaxTree queryTree, CancellationToken cancellationToken);
SemanticSearch\SemanticSearchUtilities.cs (2)
30public static List<MetadataReference> GetMetadataReferences(IMetadataService metadataService, string directory) 34var metadataReferences = new List<MetadataReference>();
Workspace\MiscellaneousFileUtilities.cs (1)
25ImmutableArray<MetadataReference> metadataReferences)
Microsoft.CodeAnalysis.LanguageServer (1)
HostWorkspace\MetadataService.cs (1)
32MetadataReference.CreateFromFile(path, properties, documentationProviderService.GetDocumentationProvider(path)));
Microsoft.CodeAnalysis.LanguageServer.Protocol (6)
Features\DecompiledSource\AssemblyResolver.cs (5)
24private static readonly Dictionary<MetadataReference, (string fileName, ImmutableArray<byte> image)> _inMemoryImagesForTesting = []; 63public PEFile TryResolve(MetadataReference metadataReference, PEStreamOptions streamOptions) 132var reference = _parentCompilation.GetMetadataReference(assembly); 174public static void AddInMemoryImage(MetadataReference reference, string fileName, ImmutableArray<byte> image) 180public static bool ContainsInMemoryImage(MetadataReference reference)
Features\DecompiledSource\CSharpCodeDecompilerDecompilationService.cs (1)
37public Document? PerformDecompilation(Document document, string fullName, Compilation compilation, MetadataReference? metadataReference, string? assemblyLocation)
Microsoft.CodeAnalysis.Rebuild (10)
CompilationFactory.cs (2)
53ImmutableArray<MetadataReference> metadataReferences); 70ImmutableArray<MetadataReference> metadataReferences,
CompilationOptionsReader.cs (5)
287public (ImmutableArray<SyntaxTree> SyntaxTrees, ImmutableArray<MetadataReference> MetadataReferences) ResolveArtifacts( 322ImmutableArray<MetadataReference> ResolveMetadataReferences() 324var builder = ImmutableArray.CreateBuilder<MetadataReference>(); 327var metadataReference = resolver.ResolveMetadataReference(metadataReferenceInfo); 355var builder = ImmutableArray.CreateBuilder<MetadataReference>();
CSharpCompilationFactory.cs (1)
49ImmutableArray<MetadataReference> metadataReferences)
IRebuildArtifactResolver.cs (1)
13MetadataReference ResolveMetadataReference(MetadataReferenceInfo metadataReferenceInfo);
VisualBasicCompilationFactory.cs (1)
49ImmutableArray<MetadataReference> metadataReferences)
Microsoft.CodeAnalysis.Rebuild.UnitTests (5)
BasicDeterministicKeyBuilderTests.cs (1)
36protected override VisualBasicCompilation CreateCompilation(SyntaxTree[] syntaxTrees, MetadataReference[]? references = null, VisualBasicCompilationOptions? options = null)
CompilationRebuildArtifactResolver.cs (1)
21public MetadataReference ResolveMetadataReference(MetadataReferenceInfo metadataReferenceInfo) =>
CSharpDeterministicKeyBuilderTests.cs (1)
35protected override CSharpCompilation CreateCompilation(SyntaxTree[] syntaxTrees, MetadataReference[]? references = null, CSharpCompilationOptions? options = null) =>
DeterministicKeyBuilderTests.cs (2)
197protected JObject GetReferenceValue(MetadataReference reference) 265MetadataReference[]? references = null,
Microsoft.CodeAnalysis.Remote.ServiceHub (2)
Host\AssetProvider.cs (1)
198tasks.Add(SynchronizeProjectAssetCollectionAsync<MetadataReference>(new(AssetPathKind.ProjectMetadataReferences, projectId), static p => p.MetadataReferences));
Host\RemoteWorkspace.SolutionCreator.cs (1)
372project = project.WithMetadataReferences(await _assetProvider.GetAssetsArrayAsync<MetadataReference>(
Microsoft.CodeAnalysis.Remote.Workspaces (1)
AbstractAssetProvider.cs (1)
91var metadataReferencesTask = this.GetAssetsArrayAsync<MetadataReference>(new(AssetPathKind.ProjectMetadataReferences, projectId), projectChecksums.MetadataReferences, cancellationToken);
Microsoft.CodeAnalysis.Scripting (27)
Hosting\CommandLine\CommandLineHelpers.cs (1)
22return options.WithReferences(Array.Empty<MetadataReference>()).WithImports(Array.Empty<string>());
Hosting\CommandLine\CommandLineRunner.cs (1)
159var resolvedReferences = new List<MetadataReference>();
Hosting\Resolvers\RuntimeMetadataReferenceResolver.cs (1)
97public override PortableExecutableReference? ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity)
Script.cs (10)
138WithReferences(ImmutableArray<MetadataReference>.Empty). 246internal ImmutableArray<MetadataReference> GetReferencesForCompilation( 249MetadataReference languageRuntimeReferenceOpt = null) 252var references = ArrayBuilder<MetadataReference>.GetInstance(); 266if (MetadataReference.HasMetadata(globalsAssembly)) 279foreach (var reference in Options.MetadataReferences) 320var filePath = MetadataReference.GetAssemblyFilePath(assembly, properties); 325/// <see cref="MetadataReference.CreateFromFile(string, PEStreamOptions, MetadataReferenceProperties, DocumentationProvider)"/> 328/// This API exists as the default for reading <see cref="MetadataReference"/> from files. It is handy 337MetadataReference.CreateFromFile(filePath, options, properties);
ScriptMetadataResolver.cs (1)
67public override PortableExecutableReference? ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity)
ScriptOptions.cs (13)
39private static ImmutableArray<MetadataReference> GetDefaultMetadataReferences() 43return ImmutableArray<MetadataReference>.Empty; 80/// An array of <see cref="MetadataReference"/>s to be added to the script. 88public ImmutableArray<MetadataReference> MetadataReferences { get; private set; } 147ImmutableArray<MetadataReference> references, 208private static MetadataReference CreateUnresolvedReference(string reference) 215private ScriptOptions WithReferences(ImmutableArray<MetadataReference> references) 222public ScriptOptions WithReferences(IEnumerable<MetadataReference> references) 229public ScriptOptions WithReferences(params MetadataReference[] references) 230=> WithReferences((IEnumerable<MetadataReference>)references); 236public ScriptOptions AddReferences(IEnumerable<MetadataReference> references) 242public ScriptOptions AddReferences(params MetadataReference[] references) 243=> AddReferences((IEnumerable<MetadataReference>)references);
Microsoft.CodeAnalysis.Scripting.TestUtilities (6)
ScriptTestBase.cs (1)
44var reference = MetadataReference.CreateFromFile(filePath, options, properties);
TestCompilationFactory.cs (1)
38internal static Compilation CreateCSharpCompilation(string source, IEnumerable<MetadataReference> references, string assemblyName = null, CSharpCompilationOptions options = null)
TestRuntimeMetadataReferenceResolver.cs (4)
25public override PortableExecutableReference ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity) 34return MetadataReference.CreateFromFile(testDependencyAssemblyPath, s_resolvedMissingAssemblyReferenceProperties); 41return MetadataReference.CreateFromFile(fxAssemblyPath, s_resolvedMissingAssemblyReferenceProperties); 53return ImmutableArray.Create(MetadataReference.CreateFromFile(reference, properties));
Microsoft.CodeAnalysis.Scripting.UnitTests (14)
ScriptOptionsTests.cs (14)
28AddReferences(MetadataReference.CreateFromAssemblyInternal(typeof(int).GetTypeInfo().Assembly)). 40var options = ScriptOptions.Default.WithReferences(ImmutableArray<MetadataReference>.Empty); 41Assert.Throws<ArgumentNullException>("references", () => options.AddReferences((MetadataReference[])null)); 42Assert.Throws<ArgumentNullException>("references[0]", () => options.AddReferences(new MetadataReference[] { null })); 44Assert.Throws<ArgumentNullException>("references", () => options.AddReferences((IEnumerable<MetadataReference>)null)); 45Assert.Throws<ArgumentNullException>("references[0]", () => options.AddReferences((IEnumerable<MetadataReference>)new MetadataReference[] { null })); 63var empty = ScriptOptions.Default.WithReferences(ImmutableArray<MetadataReference>.Empty); 82var options = ScriptOptions.Default.WithReferences(ImmutableArray<MetadataReference>.Empty); 83Assert.Throws<ArgumentNullException>("references", () => options.WithReferences((MetadataReference[])null)); 84Assert.Throws<ArgumentNullException>("references", () => options.WithReferences((IEnumerable<MetadataReference>)null)); 85Assert.Throws<ArgumentNullException>("references", () => options.WithReferences(default(ImmutableArray<MetadataReference>))); 86Assert.Throws<ArgumentNullException>("references[0]", () => options.WithReferences(new MetadataReference[] { null })); 87Assert.Throws<ArgumentNullException>("references[0]", () => options.WithReferences(ImmutableArray.Create((MetadataReference)null)));
Microsoft.CodeAnalysis.Test.Utilities (206)
AssemblyLoadTestFixture.cs (15)
194var delta1Reference = MetadataReference.CreateFromFile(Delta1); 225var delta2Reference = MetadataReference.CreateFromFile(Delta2); 245GammaReferencingPublicSigned = GenerateDll("GammaReferencingPublicSigned", _directory.CreateDirectory("GammaReferencingPublicSigned"), GammaSource, MetadataReference.CreateFromFile(DeltaPublicSigned1)); 247var gammaReference = MetadataReference.CreateFromFile(Gamma); 301EpsilonReferencingPublicSigned = GenerateDll("EpsilonReferencingPublicSigned", v2PublicSignedDirectory, EpsilonSource, MetadataReference.CreateFromFile(DeltaPublicSigned2)); 342var compilerReference = MetadataReference.CreateFromFile(typeof(Microsoft.CodeAnalysis.SyntaxNode).Assembly.Location); 361var userSystemCollectionsImmutableReference = MetadataReference.CreateFromFile(UserSystemCollectionsImmutable); 403", MetadataReference.CreateFromFile(delta1InAnalyzerReferencesDelta1.Path), compilerReference); 416var realSciReference = MetadataReference.CreateFromFile(typeof(ImmutableArray).Assembly.Location); 440}", realSciReference, compilerReference, MetadataReference.CreateFromFile(AnalyzerDependency)); 478var fakeCompilerReference = MetadataReference.CreateFromFile(fakeCompilerAssembly); 506var laterCompilerReference = MetadataReference.CreateFromFile(laterFakeCompilerAssembly); 516private static string GenerateDll(string assemblyName, TempDirectory directory, string csSource, params MetadataReference[] additionalReferences) 521private static string GenerateDll(string assemblyName, TempDirectory directory, string csSource, ImmutableArray<byte> publicKeyOpt, params MetadataReference[] additionalReferences) 533references: (new MetadataReference[]
BaseCompilerFeatureRequiredTests.cs (5)
616protected abstract TCompilation CreateCompilation(TSource source, MetadataReference[] references); 665var compiledIl = CompileIL(il, prependDefaultHeader: false); 679protected abstract void AssertAssemblyErrors(TCompilation compilation, MetadataReference ilRef); 695var compiledIl = CompileIL(il); 708protected abstract void AssertModuleErrors(TCompilation compilation, MetadataReference ilRef);
CommonTestBase.cs (18)
244internal static MetadataReference CompileIL(string ilSource, bool prependDefaultHeader = true, bool embedInteropTypes = false, bool autoInherit = true) 250internal static MetadataReference GetILModuleReference(string ilSource, bool prependDefaultHeader = true) 265IEnumerable<MetadataReference> referencedAssemblies = null) 275IEnumerable<MetadataReference> referencedAssemblies = null, 292IEnumerable<MetadataReference> referencedAssemblies = null) 302IEnumerable<MetadataReference> referencedAssemblies = null, 319IEnumerable<MetadataReference> referencedAssemblies = null) 329IEnumerable<MetadataReference> referencedAssemblies = null, 340IEnumerable<MetadataReference> referencedAssemblies = null, 352IEnumerable<MetadataReference> referencedAssemblies = null, 371var references = new List<MetadataReference>(); 405IEnumerable<MetadataReference> referencedAssemblies = null) 415IEnumerable<MetadataReference> referencedAssemblies = null) 425IEnumerable<MetadataReference> referencedAssemblies = null, 436IEnumerable<MetadataReference> referencedAssemblies = null, 458var references = new List<MetadataReference>(); 484private void AddReferencedCompilations(IEnumerable<Compilation> referencedCompilations, List<MetadataReference> references) 495internal static MetadataReference AsReference(Compilation comp, bool useCompilationReference)
Compilation\CompilationExtensions.cs (1)
115public static MetadataReference EmitToImageReference(
Compilation\IRuntimeEnvironment.cs (1)
96foreach (var metadataReference in compilation.References)
Compilation\MetadataReferenceExtensions.cs (3)
17public static Guid GetModuleVersionId(this MetadataReference metadataReference) 20public static AssemblyIdentity GetAssemblyIdentity(this MetadataReference reference) 23public static ModuleMetadata GetManifestModuleMetadata(this MetadataReference reference)
CompilationVerifier.cs (3)
659var targetReference = LoadTestEmittedExecutableForSymbolValidation(EmittedAssemblyData, _compilation.Options.OutputKind, display: _compilation.AssemblyName); 688internal IModuleSymbol GetSymbolFromMetadata(MetadataReference metadataReference, MetadataImportOptions importOptions) 708internal static MetadataReference LoadTestEmittedExecutableForSymbolValidation(
Mocks\StdOle.cs (1)
25public static PortableExecutableReference Build(IEnumerable<MetadataReference> references)
Mocks\TestMessageProvider.cs (4)
258public override void ReportDuplicateMetadataReferenceStrong(DiagnosticBag diagnostics, Location location, MetadataReference reference, AssemblyIdentity identity, MetadataReference equivalentReference, AssemblyIdentity equivalentIdentity) 263public override void ReportDuplicateMetadataReferenceWeak(DiagnosticBag diagnostics, Location location, MetadataReference reference, AssemblyIdentity identity, MetadataReference equivalentReference, AssemblyIdentity equivalentIdentity)
Mocks\TestMissingMetadataReferenceResolver.cs (6)
19public readonly MetadataReference Reference; 22public ReferenceAndIdentity(MetadataReference reference, AssemblyIdentity identity) 34private readonly Dictionary<string, MetadataReference> _map; 37public TestMissingMetadataReferenceResolver(Dictionary<string, MetadataReference> map) 42public override PortableExecutableReference ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity) 47return _map.TryGetValue(nameAndVersion, out var reference) ? (PortableExecutableReference)reference : null;
Platform\Desktop\DesktopRuntimeUtil.cs (3)
56return MetadataReference.CreateFromStream(uncompressed, properties, documentation, filePath); 60internal static MetadataReference CreateReflectionEmitAssembly(Action<ModuleBuilder> create) 72return MetadataReference.CreateFromImage(image);
Platform\Desktop\TestHelpers.cs (3)
83new MetadataReference[] 88MetadataReference.CreateFromFile(immutable.Path), 89MetadataReference.CreateFromFile(analyzer.Path)
TargetFrameworkUtil.cs (42)
102public static ImmutableArray<MetadataReference> References { get; } = ImmutableArray.CreateRange<MetadataReference>(Net70.References.All); 116private static ImmutableArray<MetadataReference> s_references; 124public static ImmutableArray<MetadataReference> References 144public static ImmutableArray<MetadataReference> Standard { get; } = 170public static ImmutableArray<MetadataReference> NetLatest => RuntimeUtilities.IsCoreClrRuntime ? NetCoreApp.References : NetFramework.References; 171public static ImmutableArray<MetadataReference> StandardReferences => RuntimeUtilities.IsCoreClrRuntime ? NetStandard20References : NetFramework.Standard; 172public static MetadataReference StandardCSharpReference => RuntimeUtilities.IsCoreClrRuntime ? NetStandard20.ExtraReferences.MicrosoftCSharp : NetFramework.MicrosoftCSharp; 173public static MetadataReference StandardVisualBasicReference => RuntimeUtilities.IsCoreClrRuntime ? NetStandard20.ExtraReferences.MicrosoftVisualBasic : NetFramework.MicrosoftVisualBasic; 174public static ImmutableArray<MetadataReference> StandardAndCSharpReferences => StandardReferences.Add(StandardCSharpReference); 175public static ImmutableArray<MetadataReference> StandardAndVBRuntimeReferences => StandardReferences.Add(StandardVisualBasicReference); 183public static ImmutableArray<MetadataReference> WinRTReferences => 187public static ImmutableArray<MetadataReference> MinimalReferences => 191public static ImmutableArray<MetadataReference> MinimalAsyncReferences => 200public static ImmutableArray<MetadataReference> Mscorlib45ExtendedReferences { get; } = 208public static ImmutableArray<MetadataReference> Mscorlib46ExtendedReferences { get; } = 216public static ImmutableArray<MetadataReference> Mscorlib40References { get; } = 220public static ImmutableArray<MetadataReference> Mscorlib40ExtendedReferences { get; } = 226public static ImmutableArray<MetadataReference> Mscorlib40andSystemCoreReferences { get; } = 231public static ImmutableArray<MetadataReference> Mscorlib40andVBRuntimeReferences { get; } = 237public static ImmutableArray<MetadataReference> Mscorlib45References { get; } = 241public static ImmutableArray<MetadataReference> Mscorlib46References { get; } = 245public static ImmutableArray<MetadataReference> Mscorlib461References { get; } = 249public static ImmutableArray<MetadataReference> Mscorlib461ExtendedReferences { get; } = 257public static ImmutableArray<MetadataReference> Mscorlib461AndCSharpReferences { get; } = 263public static ImmutableArray<MetadataReference> Mscorlib461AndVBRuntimeReferences { get; } = 269public static ImmutableArray<MetadataReference> NetStandard20References { get; } = 279public static ImmutableArray<MetadataReference> DefaultVbReferences { get; } = 298public static ImmutableArray<MetadataReference> GetReferences(TargetFramework targetFramework) => targetFramework switch 302TargetFramework.Empty => ImmutableArray<MetadataReference>.Empty, 304TargetFramework.Net50 => ImmutableArray.CreateRange<MetadataReference>(LoadDynamicReferences("Net50")), 305TargetFramework.Net60 => ImmutableArray.CreateRange<MetadataReference>(LoadDynamicReferences("Net60")), 306TargetFramework.NetCoreApp or TargetFramework.Net70 => ImmutableArray.CreateRange<MetadataReference>(Net70.References.All), 307TargetFramework.Net80 => ImmutableArray.CreateRange<MetadataReference>(LoadDynamicReferences("Net80")), 308TargetFramework.Net90 => ImmutableArray.CreateRange<MetadataReference>(LoadDynamicReferences("Net90")), 333public static ImmutableArray<MetadataReference> GetReferences(TargetFramework tf, IEnumerable<MetadataReference> additionalReferences) 350foreach (var r in additionalReferences) 365IEnumerable<string> getNames(IEnumerable<MetadataReference> e) 367foreach (var r in e) 377string getName(MetadataReference m) 398public static IEnumerable<MetadataReference> GetReferencesWithout(TargetFramework targetFramework, params string[] excludeReferenceNames) =>
TestBase.cs (101)
81private static readonly Lazy<MetadataReference[]> s_lazyDefaultVbReferences = new Lazy<MetadataReference[]>( 84public static MetadataReference[] DefaultVbReferences => s_lazyDefaultVbReferences.Value; 86private static readonly Lazy<MetadataReference[]> s_lazyLatestVbReferences = new Lazy<MetadataReference[]>( 89public static MetadataReference[] LatestVbReferences => s_lazyLatestVbReferences.Value; 99private static readonly Lazy<MetadataReference[]> s_winRtRefs = new Lazy<MetadataReference[]>( 124return new MetadataReference[] { winmd, windowsruntime, runtime, objectModel, uixaml, interop, system, mscor }; 127public static MetadataReference[] WinRtRefs => s_winRtRefs.Value; 132private static readonly Lazy<MetadataReference[]> s_portableRefsMinimal = new Lazy<MetadataReference[]>( 133() => new MetadataReference[] { MscorlibPP7Ref, SystemRuntimePP7Ref }, 135public static MetadataReference[] PortableRefsMinimal => s_portableRefsMinimal.Value; 140public static MetadataReference LinqAssemblyRef => SystemCoreRef; 145public static MetadataReference ExtensionAssemblyRef => SystemCoreRef; 147private static readonly Lazy<MetadataReference> s_systemCoreRef = 148new Lazy<MetadataReference>( 151public static MetadataReference SystemCoreRef => s_systemCoreRef.Value; 153private static readonly Lazy<MetadataReference> s_systemCoreRef_v4_0_30319_17929 = new Lazy<MetadataReference>( 156public static MetadataReference SystemCoreRef_v4_0_30319_17929 => s_systemCoreRef_v4_0_30319_17929.Value; 158private static readonly Lazy<MetadataReference> s_systemRuntimeSerializationRef_v4_0_30319_17929 = new Lazy<MetadataReference>( 161public static MetadataReference SystemRuntimeSerializationRef_v4_0_30319_17929 => s_systemRuntimeSerializationRef_v4_0_30319_17929.Value; 163private static readonly Lazy<MetadataReference> s_systemCoreRef_v46 = new Lazy<MetadataReference>( 166public static MetadataReference SystemCoreRef_v46 => s_systemCoreRef_v4_0_30319_17929.Value; 168private static readonly Lazy<MetadataReference> s_systemWindowsFormsRef = new Lazy<MetadataReference>( 171public static MetadataReference SystemWindowsFormsRef => s_systemWindowsFormsRef.Value; 173private static readonly Lazy<MetadataReference> s_systemDrawingRef = new Lazy<MetadataReference>( 176public static MetadataReference SystemDrawingRef => s_systemDrawingRef.Value; 178private static readonly Lazy<MetadataReference> s_systemDataRef = new Lazy<MetadataReference>( 181public static MetadataReference SystemDataRef => s_systemDataRef.Value; 183private static readonly Lazy<MetadataReference> s_mscorlibRef = new Lazy<MetadataReference>( 186public static MetadataReference MscorlibRef => s_mscorlibRef.Value; 188private static readonly Lazy<MetadataReference> s_aacorlibRef = new Lazy<MetadataReference>( 209public static MetadataReference AacorlibRef => s_aacorlibRef.Value; 211public static MetadataReference MscorlibRef_v20 => Net20.References.mscorlib; 213public static MetadataReference MscorlibRef_v4_0_30316_17626 => NetFramework.mscorlib; 215private static readonly Lazy<MetadataReference> s_mscorlibRef_v46 = new Lazy<MetadataReference>( 218public static MetadataReference MscorlibRef_v46 => s_mscorlibRef_v46.Value; 220public static MetadataReference MinCorlibRef => TestReferences.NetFx.Minimal.mincorlib; 222public static MetadataReference MinAsyncCorlibRef => TestReferences.NetFx.Minimal.minasynccorlib; 224public static MetadataReference ValueTupleRef => NetFramework.SystemValueTuple; 226public static MetadataReference MsvbRef => NetFramework.MicrosoftVisualBasic; 228public static MetadataReference MsvbRef_v4_0_30319_17929 => NetFramework.MicrosoftVisualBasic; 230public static MetadataReference CSharpRef => CSharpDesktopRef; 243public static MetadataReference ValueTupleLegacyRef => TestReferences.NetFx.ValueTuple.tuplelib; 245private static readonly Lazy<MetadataReference> s_desktopCSharpRef = new Lazy<MetadataReference>( 248public static MetadataReference CSharpDesktopRef => s_desktopCSharpRef.Value; 250private static readonly Lazy<MetadataReference> s_std20Ref = new Lazy<MetadataReference>( 254public static MetadataReference NetStandard20Ref => s_std20Ref.Value; 256private static readonly Lazy<MetadataReference> s_systemRef = new Lazy<MetadataReference>( 259public static MetadataReference SystemRef => s_systemRef.Value; 261private static readonly Lazy<MetadataReference> s_systemRef_v46 = new Lazy<MetadataReference>( 264public static MetadataReference SystemRef_v46 => s_systemRef_v46.Value; 266private static readonly Lazy<MetadataReference> s_systemRef_v4_0_30319_17929 = new Lazy<MetadataReference>( 269public static MetadataReference SystemRef_v4_0_30319_17929 => s_systemRef_v4_0_30319_17929.Value; 271private static readonly Lazy<MetadataReference> s_systemRef_v20 = new Lazy<MetadataReference>( 274public static MetadataReference SystemRef_v20 => s_systemRef_v20.Value; 276private static readonly Lazy<MetadataReference> s_systemXmlRef = new Lazy<MetadataReference>( 279public static MetadataReference SystemXmlRef => s_systemXmlRef.Value; 281private static readonly Lazy<MetadataReference> s_systemXmlLinqRef = new Lazy<MetadataReference>( 284public static MetadataReference SystemXmlLinqRef => s_systemXmlLinqRef.Value; 286private static readonly Lazy<MetadataReference> s_mscorlibFacadeRef = new Lazy<MetadataReference>( 289public static MetadataReference MscorlibFacadeRef => s_mscorlibFacadeRef.Value; 291private static readonly Lazy<MetadataReference> s_systemRuntimeFacadeRef = new Lazy<MetadataReference>( 294public static MetadataReference SystemRuntimeFacadeRef => s_systemRuntimeFacadeRef.Value; 296private static readonly Lazy<MetadataReference> s_systemThreadingFacadeRef = new Lazy<MetadataReference>( 299public static MetadataReference SystemThreadingFacadeRef => s_systemThreadingTasksFacadeRef.Value; 301private static readonly Lazy<MetadataReference> s_systemThreadingTasksFacadeRef = new Lazy<MetadataReference>( 304public static MetadataReference SystemThreadingTaskFacadeRef => s_systemThreadingTasksFacadeRef.Value; 306private static readonly Lazy<MetadataReference> s_mscorlibPP7Ref = new Lazy<MetadataReference>( 309public static MetadataReference MscorlibPP7Ref => s_mscorlibPP7Ref.Value; 311private static readonly Lazy<MetadataReference> s_systemRuntimePP7Ref = new Lazy<MetadataReference>( 314public static MetadataReference SystemRuntimePP7Ref => s_systemRuntimePP7Ref.Value; 316private static readonly Lazy<MetadataReference> s_FSharpTestLibraryRef = new Lazy<MetadataReference>( 319public static MetadataReference FSharpTestLibraryRef => s_FSharpTestLibraryRef.Value; 321public static readonly MetadataReference InvalidRef = new TestMetadataReference(fullPath: @"R:\Invalid.dll");
Microsoft.CodeAnalysis.UnitTests (50)
AnalyzerAssemblyLoaderTests.cs (3)
1202var compilerReference = MetadataReference.CreateFromFile(typeof(SyntaxNode).Assembly.Location); 1203var immutableReference = MetadataReference.CreateFromFile(typeof(ImmutableArray).Assembly.Location); 1320MetadataReference.CreateFromFile(deltaFilePath)
Analyzers\AnalyzerFileReferenceAppDomainTests.cs (3)
95new MetadataReference[] 100MetadataReference.CreateFromFile(immutable.Path), 101MetadataReference.CreateFromFile(analyzer.Path)
Analyzers\AnalyzerFileReferenceTests.cs (1)
486TargetFrameworkUtil.GetReferences(TargetFramework.Standard, new[] { MetadataReference.CreateFromAssemblyInternal(typeof(ISourceGenerator).Assembly) }),
Diagnostics\SuppressMessageAttributeCompilerTests.cs (3)
37private static readonly Lazy<ImmutableArray<MetadataReference>> s_references = new Lazy<ImmutableArray<MetadataReference>>(() => 58var compRef = CSharpCompilation.Create("unconditionalsuppress",
GivesAccessTo.cs (4)
44var csc = (Compilation)CSharpCompilation.Create("CS", new[] { csharpTree }, new MetadataReference[] { TestBase.MscorlibRef }); 47var csc2 = (Compilation)CSharpCompilation.Create("CS2", new[] { csharpTree2 }, new MetadataReference[] { TestBase.MscorlibRef }); 50var vbc = VisualBasicCompilation.Create("VB", new[] { vbTree }, new MetadataReference[] { TestBase.MscorlibRef }); 53var vbc2 = VisualBasicCompilation.Create("VB2", new[] { vbTree2 }, new MetadataReference[] { TestBase.MscorlibRef });
IsSymbolAccessibleWithinTests.cs (2)
28var csc = CSharpCompilation.Create("CS", new[] { csharpTree }, new MetadataReference[] { TestBase.MscorlibRef }) as Compilation; 31var vbc = VisualBasicCompilation.Create("VB", new[] { vbTree }, new MetadataReference[] { TestBase.MscorlibRef }) as Compilation;
MetadataReferences\MetadataReferenceTests.cs (34)
35Assert.Throws<NotSupportedException>(() => MetadataReference.CreateFromAssemblyInternal(dynamicAssembly)); 39Assert.Throws<NotSupportedException>(() => MetadataReference.CreateFromAssemblyInternal(inMemoryAssembly)); 45Assert.Throws<ArgumentNullException>(() => MetadataReference.CreateFromImage(null)); 46Assert.Throws<ArgumentNullException>(() => MetadataReference.CreateFromImage(default)); 47Assert.Throws<ArgumentNullException>(() => MetadataReference.CreateFromFile(null)); 48Assert.Throws<ArgumentNullException>(() => MetadataReference.CreateFromFile(null, default(MetadataReferenceProperties))); 49Assert.Throws<ArgumentNullException>(() => MetadataReference.CreateFromStream(null)); 51Assert.Throws<ArgumentNullException>(() => MetadataReference.CreateFromAssemblyInternal(null)); 52Assert.Throws<ArgumentException>(() => MetadataReference.CreateFromAssemblyInternal(typeof(object).Assembly, new MetadataReferenceProperties(MetadataImageKind.Module))); 55Assert.Throws<NotSupportedException>(() => MetadataReference.CreateFromAssemblyInternal(dynamicAssembly)); 65? MetadataReference.CreateFromImage(peImage.AsImmutable(), properties) 66: MetadataReference.CreateFromImage(peImage.AsEnumerable(), properties); 81? MetadataReference.CreateFromImage(peImage.AsImmutable(), MetadataReferenceProperties.Module) 82: MetadataReference.CreateFromImage(peImage.AsEnumerable(), MetadataReferenceProperties.Module); 98var r = MetadataReference.CreateFromStream(stream); 118var r = MetadataReference.CreateFromStream(new MemoryStream(TestResources.General.C1, writable: false)); 129var r = MetadataReference.CreateFromStream( 145var r = MetadataReference.CreateFromStream( 163var r = MetadataReference.CreateFromFile(file.Path, 173Assert.Equal(props, MetadataReference.CreateFromFile(file.Path, props).Properties); 187var r = MetadataReference.CreateFromFile(file.Path, MetadataReferenceProperties.Module); 196Assert.Equal(props, MetadataReference.CreateFromFile(file.Path, props).Properties); 208var r = (PortableExecutableReference)MetadataReference.CreateFromAssemblyInternal(assembly); 217Assert.Equal(props, MetadataReference.CreateFromAssemblyInternal(assembly, props).Properties); 225var r = (PortableExecutableReference)MetadataReference.CreateFromAssemblyInternal(assembly, new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("a", "b"), embedInteropTypes: true), documentation: doc); 431MetadataReference r; 433r = MetadataReference.CreateFromImage(TestResources.General.C1); 439r = MetadataReference.CreateFromImage(TestResources.General.C1, filePath: @"c:\blah"); 526var f1 = MscorlibRef; 527var f2 = SystemCoreRef; 543var all = new MetadataReference[] { f1, f2, i1, i2, m1a, m1b, m2, c1a, c1b, c2 }; 544foreach (var r in all) 546foreach (var s in all) 584var r = MetadataReference.CreateFromStream(new MemoryStream(TestResources.SymbolsTests.Metadata.InvalidPublicKey, writable: false));
Microsoft.CodeAnalysis.VisualBasic (43)
CommandLine\VisualBasicCommandLineArguments.vb (1)
68resolved As List(Of MetadataReference)
CommandLine\VisualBasicCompiler.vb (1)
183Private Sub PrintReferences(resolvedReferences As List(Of MetadataReference), consoleOutput As TextWriter)
Compilation\VisualBasicCompilation.vb (23)
327Optional references As IEnumerable(Of MetadataReference) = Nothing, 346Optional references As IEnumerable(Of MetadataReference) = Nothing, 370references As IEnumerable(Of MetadataReference), 419references As ImmutableArray(Of MetadataReference), 576Public Shadows Function WithReferences(ParamArray newReferences As MetadataReference()) As VisualBasicCompilation 577Return WithReferences(DirectCast(newReferences, IEnumerable(Of MetadataReference))) 584''' The new <see cref="VisualBasicCompilation"/> will query the given <see cref="MetadataReference"/> for the underlying 587''' The New compilation uses whatever metadata is currently being provided by the <see cref="MetadataReference"/>. 591Public Shadows Function WithReferences(newReferences As IEnumerable(Of MetadataReference)) As VisualBasicCompilation 1297Public Overrides ReadOnly Property DirectiveReferences As ImmutableArray(Of MetadataReference) 1303Friend Overrides ReadOnly Property ReferenceDirectiveMap As IDictionary(Of (path As String, content As String), MetadataReference) 1316Friend Shadows Function GetAssemblyOrModuleSymbol(reference As MetadataReference) As Symbol 1335''' Gets the <see cref="MetadataReference"/> that corresponds to the assembly symbol. 1337Friend Shadows Function GetMetadataReference(assemblySymbol As AssemblySymbol) As MetadataReference 1341Private Protected Overrides Function CommonGetMetadataReference(assemblySymbol As IAssemblySymbol) As MetadataReference 1366Public Shadows Function AddReferences(ParamArray references As MetadataReference()) As VisualBasicCompilation 1370Public Shadows Function AddReferences(references As IEnumerable(Of MetadataReference)) As VisualBasicCompilation 1374Public Shadows Function RemoveReferences(ParamArray references As MetadataReference()) As VisualBasicCompilation 1378Public Shadows Function RemoveReferences(references As IEnumerable(Of MetadataReference)) As VisualBasicCompilation 1386Public Shadows Function ReplaceReference(oldReference As MetadataReference, newReference As MetadataReference) As VisualBasicCompilation 2720Protected Overrides Function CommonWithReferences(newReferences As IEnumerable(Of MetadataReference)) As Compilation 2803Protected Overrides Function CommonGetAssemblyOrModuleSymbol(reference As MetadataReference) As ISymbol
Errors\MessageProvider.vb (4)
386Public Overrides Sub ReportDuplicateMetadataReferenceStrong(diagnostics As DiagnosticBag, location As Location, reference As MetadataReference, identity As AssemblyIdentity, equivalentReference As MetadataReference, equivalentIdentity As AssemblyIdentity) 393Public Overrides Sub ReportDuplicateMetadataReferenceWeak(diagnostics As DiagnosticBag, location As Location, reference As MetadataReference, identity As AssemblyIdentity, equivalentReference As MetadataReference, equivalentIdentity As AssemblyIdentity)
Symbols\ReferenceManager.vb (11)
51Public Sub New(simpleAssemblyName As String, identityComparer As AssemblyIdentityComparer, observedMetadata As Dictionary(Of MetadataReference, MetadataOrDiagnostic)) 121Protected Overrides Function CheckPropertiesConsistency(primaryReference As MetadataReference, duplicateReference As MetadataReference, diagnostics As DiagnosticBag) As Boolean 299Dim boundReferenceDirectiveMap As IDictionary(Of ValueTuple(Of String, String), MetadataReference) = Nothing 300Dim boundReferenceDirectives As ImmutableArray(Of MetadataReference) = Nothing 303Dim explicitReferences As ImmutableArray(Of MetadataReference) = Nothing 321Dim implicitlyResolvedReferences As ImmutableArray(Of MetadataReference) = Nothing 351Dim referencedAssembliesMap As Dictionary(Of MetadataReference, Integer) = Nothing 352Dim referencedModulesMap As Dictionary(Of MetadataReference, Integer) = Nothing 354Dim mergedAssemblyReferencesMapOpt As Dictionary(Of MetadataReference, ImmutableArray(Of MetadataReference)) = Nothing
Symbols\UsedAssemblies.vb (3)
18Public Overrides Function GetUsedAssemblyReferences(Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of MetadataReference) 22Return ImmutableArray(Of MetadataReference).Empty 26Dim builder = ArrayBuilder(Of MetadataReference).GetInstance(usedAssemblies.Count)
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (2)
CommandLineTests.vb (2)
2521Return ImmutableArray.Create(MetadataReference.CreateFromFile(resolvedPath, properties)) 10879TargetFrameworkUtil.GetReferences(Roslyn.Test.Utilities.TargetFramework.Standard, {MetadataReference.CreateFromAssemblyInternal(GetType(ISourceGenerator).Assembly)}),
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (80)
Attributes\AssemblyAttributes.vb (7)
1217Optional references As IEnumerable(Of MetadataReference) = Nothing, 1218Optional nameSuffix As String = "") As MetadataReference 1224Optional references As IEnumerable(Of MetadataReference) = Nothing, 1728Dim defsRef As MetadataReference = CreateCompilationWithMscorlib40({defaultHeaderString & s_defaultNetModuleSourceBody}, references:=Nothing, options:=TestOptions.ReleaseDll).ToMetadataReference() 1729Dim netmodule1Ref As MetadataReference = GetNetModuleWithAssemblyAttributesRef(source2, "", references:={defsRef}, nameSuffix:="1") 1740Dim netmodule2Ref As MetadataReference = GetNetModuleWithAssemblyAttributesRef(source1, "", references:={defsRef}, nameSuffix:="2") 1814Dim defsRef As MetadataReference = CreateCompilationWithMscorlib40({defaultImportsString & s_defaultNetModuleSourceBody}, references:=Nothing, options:=TestOptions.ReleaseDll).ToMetadataReference()
Attributes\AttributeTests.vb (13)
645{MetadataReference.CreateFromImage(TestResources.SymbolsTests.Metadata.MDTestAttributeDefLib.AsImmutableOrNull())}, 762{MetadataReference.CreateFromImage(TestResources.SymbolsTests.Metadata.AttributeTestDef01)}, 844{MetadataReference.CreateFromImage(TestResources.SymbolsTests.Metadata.AttributeTestDef01)}, 897{MetadataReference.CreateFromImage(TestResources.SymbolsTests.Metadata.AttributeTestDef01)}, 934{MetadataReference.CreateFromImage(TestResources.SymbolsTests.Metadata.AttributeTestDef01)}, 1004{MetadataReference.CreateFromImage(TestResources.SymbolsTests.Metadata.AttributeTestDef01.AsImmutableOrNull())}, 1060{MetadataReference.CreateFromImage(TestResources.SymbolsTests.Metadata.AttributeTestDef01)}, 1881Dim ref1 = MetadataReference.CreateFromImage(metadata1) 1896Dim ref2 = MetadataReference.CreateFromImage(metadata2) 1924Dim classLibrary = MetadataReference.CreateFromImage(compilation1.EmitToArray()) 1975Dim classLibrary = MetadataReference.CreateFromImage(compilation1.EmitToArray()) 2723{MetadataReference.CreateFromImage(TestResources.SymbolsTests.Metadata.AttributeTestDef01)}) 3998Dim metadataLibRef As MetadataReference = compWithAttribute.ToMetadataReference()
Attributes\AttributeTests_Experimental.vb (1)
722Private Shared Function CreateDeprecatedAndExperimentalAttributeReference() As MetadataReference
Attributes\AttributeTests_ObsoleteAttribute.vb (1)
472Dim peReference = MetadataReference.CreateFromImage(CreateCompilationWithMscorlib40AndVBRuntime(peSource).EmitToArray())
Attributes\AttributeTests_Tuples.vb (2)
107Private Shared ReadOnly s_valueTupleRefs As MetadataReference() = New MetadataReference() {ValueTupleRef, SystemRuntimeFacadeRef}
Attributes\AttributeTests_WellKnownAttributes.vb (1)
3610Dim classLibrary = MetadataReference.CreateFromImage(compilation1.EmitToArray())
Attributes\InternalsVisibleToAndStrongNameTests.vb (7)
631</compilation>, {MetadataReference.CreateFromImage(otherImage)}, TestOptions.SigningReleaseDll, parseOptions:=parseOptions) 656</compilation>, {MetadataReference.CreateFromImage(otherImage)}, TestOptions.SigningReleaseDll, parseOptions:=parseOptions) 854</compilation>, {MetadataReference.CreateFromImage(other.EmitToArray())}, TestOptions.SigningReleaseDll.WithCryptoKeyFile(s_keyPairFile).WithDelaySign(True), parseOptions:=parseOptions) 1690CompileAndVerify(other.WithReferences({other.References(0), MetadataReference.CreateFromImage(unsigned.EmitToArray)})).VerifyDiagnostics() 1723other.WithReferences({other.References(0), MetadataReference.CreateFromImage(unsigned.EmitToArray)})} 2568Dim imageReference As MetadataReference = other.EmitToImageReference() 2685Dim imageReference As MetadataReference = other.EmitToImageReference()
CodeGen\CodeGenSyncLock.vb (1)
90Dim allReferences As MetadataReference() = {
CodeGen\CodeGenTests.vb (5)
10483</compilation>, references:={MetadataReference.CreateFromImage(Net40.Resources.mscorlib.AsImmutableOrNull())})) 10500</compilation>, references:={MetadataReference.CreateFromImage(Net40.Resources.mscorlib.AsImmutableOrNull()), ref1}) 10541</compilation>, references:={MetadataReference.CreateFromImage(Net40.Resources.mscorlib.AsImmutableOrNull())})) 10568</compilation>, references:={MetadataReference.CreateFromImage(Net40.Resources.mscorlib.AsImmutableOrNull()), ref1}) 13658Dim compilation = CompileAndVerify(source, references:=New MetadataReference() {testReference})
CodeGen\CodeGenTuples.vb (5)
22ReadOnly s_valueTupleRefs As MetadataReference() = New MetadataReference() {ValueTupleRef, SystemRuntimeFacadeRef} 23ReadOnly s_valueTupleRefsAndDefault As MetadataReference() = New MetadataReference() {ValueTupleRef, 22639Dim getReference As Func(Of Compilation, MetadataReference) = Function(c) If(useImageReferences, c.EmitToImageReference(), c.ToMetadataReference())
CodeGen\CodeGenVBCore.vb (2)
2436references:=NoVbRuntimeReferences.Concat({MetadataReference.CreateFromImage(memory.ToImmutable())}), 3292Protected NoVbRuntimeReferences As MetadataReference() = {MscorlibRef, SystemRef, SystemCoreRef}
CodeGen\WinRTCollectionTests.vb (4)
14Private _legacyRefs As MetadataReference() = Nothing 16Public ReadOnly Property LegacyRefs As MetadataReference() 19Dim listRefs = New List(Of MetadataReference)(WinRtRefs.Length + 2) 6299Dim allRefs = New List(Of MetadataReference)(WinRtRefs)
Emit\CompilationEmitTests.vb (14)
291Dim usingComp = CreateCompilationWithMscorlib40(srcUsing, references:={MetadataReference.CreateFromImage(mdOnlyImage.AsImmutableOrNull())}) 876Private Sub RefAssemblyNoPia_VerifyRefOnly(source As Xml.Linq.XElement, reference As MetadataReference) 882Private Sub RefAssemblyNoPia_VerifyRefOut(source As Xml.Linq.XElement, reference As MetadataReference) 948Private Sub RefAssemblyNoPiaReferenceFromMethodBody_VerifyRefOnly(source As Xml.Linq.XElement, reference As MetadataReference) 954Private Sub RefAssemblyNoPiaReferenceFromMethodBody_VerifyRefOut(source As Xml.Linq.XElement, reference As MetadataReference) 2037c = VisualBasicCompilation.Create("Nothing", references:={MetadataReference.CreateFromImage(s.ToImmutable())}) 3860Dim refCompilation = CreateEmptyCompilationWithReferences(refSource, New MetadataReference() {}, TestOptions.ReleaseDll.WithPlatform(Platform.Itanium)) 3952Dim refCompilation = CreateEmptyCompilationWithReferences(refSource, New MetadataReference() {}, TestOptions.ReleaseModule.WithPlatform(Platform.Itanium)) 4003Dim refCompilation = CreateEmptyCompilationWithReferences(refSource, New MetadataReference() {}, TestOptions.ReleaseDll.WithPlatform(Platform.X86)) 4065Dim refCompilation = CreateEmptyCompilationWithReferences(refSource, New MetadataReference() {}, TestOptions.ReleaseModule.WithPlatform(Platform.X86)) 4099Dim refCompilation = CreateEmptyCompilationWithReferences(refSource, New MetadataReference() {}, TestOptions.ReleaseDll.WithPlatform(Platform.AnyCpu)) 4157Dim refCompilation = CreateEmptyCompilationWithReferences(refSource, New MetadataReference() {}, TestOptions.ReleaseModule.WithPlatform(Platform.AnyCpu)) 4190Dim refCompilation = CreateEmptyCompilationWithReferences(refSource, New MetadataReference() {}, TestOptions.ReleaseDll.WithPlatform(Platform.Itanium)) 4248Dim refCompilation = CreateEmptyCompilationWithReferences(refSource, New MetadataReference() {}, TestOptions.ReleaseModule.WithPlatform(Platform.Itanium))
Emit\DynamicAnalysis\DynamicInstrumentationTests.vb (1)
2811Return CreateEmptyCompilationWithReferences(source, references:=New MetadataReference() {}, options:=TestOptions.ReleaseExe.WithDeterministic(True))
Emit\EditAndContinue\EditAndContinueTest.vb (2)
20Private ReadOnly _references As IEnumerable(Of MetadataReference) 27Optional references As IEnumerable(Of MetadataReference) = Nothing,
Emit\EditAndContinue\EditAndContinueTestBase.vb (1)
28Protected Shared ReadOnly ValueTupleRefs As MetadataReference() = {SystemRuntimeFacadeRef, ValueTupleRef}
Emit\NoPiaEmbedTypes.vb (5)
1865references:={MscorlibRef, SystemRef, MetadataReference.CreateFromImage(compilation0.EmitToArray())}) 3809references:={MetadataReference.CreateFromImage(piaCompilation2.EmitToArray())}) 3889references:={MetadataReference.CreateFromImage(piaCompilation2.EmitToArray())}) 4152references:={MetadataReference.CreateFromImage(piaCompilation2.EmitToArray())}) 4311references:={MetadataReference.CreateFromImage(piaCompilation2.EmitToArray())})
Emit\OptionalArgumentsTests.vb (4)
160Private ReadOnly _classLibrary As MetadataReference = CreateHelperLibrary(_librarySource.Value) 162Public Function CreateHelperLibrary(source As String) As MetadataReference 168Return MetadataReference.CreateFromImage(libraryCompilation.EmitToArray()) 935additionalRefs:={MetadataReference.CreateFromImage(comp1.EmitToArray())},
PDB\VisualBasicDeterministicBuildCompilationTests.vb (1)
44references:=metadataReferences.SelectAsArray(Of MetadataReference)(Function(r) r.MetadataReference),
PrivateProtected.vb (2)
209additionalRefs:={MetadataReference.CreateFromImage(baseCompilation.EmitToArray())}, 254additionalRefs:={MetadataReference.CreateFromImage(baseCompilation.EmitToArray())},
XmlLiteralTests.vb (1)
4965Dim refBuilder = ArrayBuilder(Of MetadataReference).GetInstance()
Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler (1)
CompilationExtensions.vb (1)
87Dim referencesBySimpleName As IReadOnlyDictionary(Of String, ImmutableArray(Of (AssemblyIdentity, MetadataReference))) = Nothing
Microsoft.CodeAnalysis.VisualBasic.Scripting (2)
VisualBasicScriptCompiler.vb (2)
19Private Shared ReadOnly s_vbRuntimeReference As MetadataReference = MetadataReference.CreateFromAssemblyInternal(GetType(CompilerServices.NewLateBinding).GetTypeInfo().Assembly)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (107)
Binding\Binder_Expressions_Tests.vb (3)
2348Dim c2 = CreateCompilationWithMscorlib40AndVBRuntimeAndReferences(source2, {MetadataReference.CreateFromImage(baseBuffer)}) 2378Dim c3 = CreateCompilationWithMscorlib40AndVBRuntimeAndReferences(source3, {MetadataReference.CreateFromImage(derivedBuffer), MetadataReference.CreateFromImage(image)})
Binding\BindingDelegateCreationTests.vb (2)
191Dim ref = MetadataReference.CreateFromImage(TestResources.General.DelegatesWithoutInvoke.AsImmutableOrNull()) 841Dim ref = MetadataReference.CreateFromImage(TestResources.General.DelegateByRefParamArray.AsImmutableOrNull())
Binding\BindingErrorTests.vb (8)
21570Enumerable.Empty(Of MetadataReference)()) 21698Enumerable.Empty(Of MetadataReference)()) 21886Enumerable.Empty(Of MetadataReference)()) 21914Enumerable.Empty(Of MetadataReference)()) 21952Enumerable.Empty(Of MetadataReference)()) 22050Enumerable.Empty(Of MetadataReference)()) 22073Enumerable.Empty(Of MetadataReference)()) 22105Enumerable.Empty(Of MetadataReference)())
Binding\ForEachTests.vb (2)
3980Dim compilation = CompilationUtils.CreateEmptyCompilationWithReferences(source, ImmutableArray.Create(Of MetadataReference)().AsEnumerable) 4026Dim compilation = CompilationUtils.CreateEmptyCompilationWithReferences(source, ImmutableArray.Create(Of MetadataReference)().AsEnumerable)
Compilation\CompilationAPITests.vb (14)
281Dim listRef = New List(Of MetadataReference) 539comp = comp.AddReferences(Enumerable.Empty(Of MetadataReference)()) 562Dim hs1 As New HashSet(Of MetadataReference) From {ref1, ref2, ref3} 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)) 590Dim hs = New HashSet(Of MetadataReference)() From {ref1, ref2, ref3} 598Dim col = New ObjectModel.Collection(Of MetadataReference)() From {ref1, ref2, ref3} 606Dim stack = New Concurrent.ConcurrentStack(Of MetadataReference) 617Dim queue = New Concurrent.ConcurrentQueue(Of MetadataReference) 841Dim listRef = New List(Of MetadataReference) 1206Dim listRef = New List(Of MetadataReference) From {ref1, ref2, ref3, ref4}
Compilation\ReferenceManagerTests.vb (32)
24Dim v1 = MetadataReference.CreateFromImage(TestResources.General.C1.AsImmutableOrNull()) 27Dim v2 = MetadataReference.CreateFromImage(TestResources.General.C2.AsImmutableOrNull()) 51Dim testRefV1 = CreateCompilationWithMscorlib40({testRefSource.Value}, New MetadataReference() {New VisualBasicCompilationReference(refV1), v2}, options:=TestOptions.ReleaseDll) 54Dim testRefV2 = CreateCompilationWithMscorlib40({testRefSource.Value}, New MetadataReference() {New VisualBasicCompilationReference(refV2), v1}, options:=TestOptions.ReleaseDll) 73Dim v1 = MetadataReference.CreateFromImage(TestResources.General.C1.AsImmutableOrNull()) 74Dim v2 = MetadataReference.CreateFromImage(TestResources.General.C2.AsImmutableOrNull()) 92Dim testRefV1 = CreateCompilationWithMscorlib40({refSource.Value}, New MetadataReference() {New VisualBasicCompilationReference(refV1), v2}, options:=TestOptions.ReleaseDll) 95Dim testRefV2 = CreateCompilationWithMscorlib40({refSource.Value}, New MetadataReference() {New VisualBasicCompilationReference(refV2), v1}, options:=TestOptions.ReleaseDll) 637Dim main = CreateCompilationWithMscorlib40AndVBRuntimeAndReferences(sourceMain, {MetadataReference.CreateFromImage(refLibV1.EmitToArray()), New VisualBasicCompilationReference(libV2)}) 777Dim metadataLibV1 = MetadataReference.CreateFromImage(imageLibV1) 798MetadataReference.CreateFromFile(tempFile1_copy1.Path), 799MetadataReference.CreateFromFile(tempFile2.Path), 800MetadataReference.CreateFromFile(tempFile1_copy2.Path)}, TestOptions.ReleaseDll) 808MetadataReference.CreateFromFile(tempFile1_copy1.Path), 809MetadataReference.CreateFromFile(tempFile2.Path), 810MetadataReference.CreateFromFile(tempFile1_copy1.Path)}, TestOptions.ReleaseDll) 1141Dim refB = MetadataReference.CreateFromImage(b.EmitToArray()) 1145Dim refA2 = MetadataReference.CreateFromImage(a2.EmitToArray()) 1681Dim resolver As TestMissingMetadataReferenceResolver = New TestMissingMetadataReferenceResolver(New Dictionary(Of String, MetadataReference) From 1709Dim resolver As TestMissingMetadataReferenceResolver = New TestMissingMetadataReferenceResolver(New Dictionary(Of String, MetadataReference) From 1744Dim resolver As TestMissingMetadataReferenceResolver = New TestMissingMetadataReferenceResolver(New Dictionary(Of String, MetadataReference) From 1774Dim resolver = New TestMissingMetadataReferenceResolver(New Dictionary(Of String, MetadataReference)()) 1789Dim resolver = New TestMissingMetadataReferenceResolver(New Dictionary(Of String, MetadataReference)()) 1812Dim resolver = New TestMissingMetadataReferenceResolver(New Dictionary(Of String, MetadataReference) From 1840Dim resolver = New TestMissingMetadataReferenceResolver(New Dictionary(Of String, MetadataReference) From 1872Dim resolver = New TestMissingMetadataReferenceResolver(New Dictionary(Of String, MetadataReference) From 1903Dim resolverA = New TestMissingMetadataReferenceResolver(New Dictionary(Of String, MetadataReference) From 1914Dim resolverC = New TestMissingMetadataReferenceResolver(New Dictionary(Of String, MetadataReference) From 1944Dim resolverA = New TestMissingMetadataReferenceResolver(New Dictionary(Of String, MetadataReference) From 1956Dim resolverC = New TestMissingMetadataReferenceResolver(New Dictionary(Of String, MetadataReference) From 1990Dim resolverC = New TestMissingMetadataReferenceResolver(New Dictionary(Of String, MetadataReference) From 2038Dim resolverC = New TestMissingMetadataReferenceResolver(New Dictionary(Of String, MetadataReference) From
Compilation\SuppressAccessibilityChecksTests.vb (4)
32Dim referenceA = MetadataReference.CreateFromStream(compilationA.EmitToStream()) 45]]>.Value, referencedAssemblies:=New MetadataReference() {referenceA}, 172Dim referenceA = MetadataReference.CreateFromStream(compilationA.EmitToStream()) 183]]>.Value}, New MetadataReference() {referenceA}, TestOptions.ReleaseDll.WithMetadataImportOptions(MetadataImportOptions.All))
Semantics\AccessCheckTests.vb (9)
643{MetadataReference.CreateFromImage(other.EmitToArray())}) 679</compilation>, {MetadataReference.CreateFromImage(otherImage)}) 2017</compilation>, {MetadataReference.CreateFromImage(assem1Bytes)}) 2042{MetadataReference.CreateFromImage(assem1Bytes), MetadataReference.CreateFromImage(assem2Bytes)}) 2079Dim reference1 = MetadataReference.CreateFromImage(compilationVerifier.EmittedAssemblyData) 2096Dim reference2 = MetadataReference.CreateFromImage(compilationVerifier.EmittedAssemblyData) 2131Dim reference1 = MetadataReference.CreateFromImage(compilationVerifier.EmittedAssemblyData) 2148Dim reference2 = MetadataReference.CreateFromImage(compilationVerifier.EmittedAssemblyData)
Semantics\ConditionalAccessTests.vb (4)
10229Dim valueTupleRefs As MetadataReference() = New MetadataReference() {ValueTupleRef, SystemRuntimeFacadeRef} 10302Dim valueTupleRefs As MetadataReference() = New MetadataReference() {ValueTupleRef, SystemRuntimeFacadeRef}
Semantics\FieldInitializerBindingTests.vb (2)
1395Dim reference As MetadataReference = Nothing 1397reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path))
Semantics\MissingRuntimeHelpers.vb (3)
90Dim compilation = CompilationUtils.CreateEmptyCompilationWithReferences(compilationDef, New MetadataReference() {}) 268Dim compilation = CompilationUtils.CreateEmptyCompilationWithReferences(compilationDef, New MetadataReference() {}) 361Dim compilation = CompilationUtils.CreateEmptyCompilationWithReferences(compilationDef, New MetadataReference() {})
Semantics\NoncompliantOverloadingInMetadata.vb (2)
2647Dim ilAssemblyRef1 As MetadataReference = Nothing 3277Dim ilAssemblyRef2 As MetadataReference = Nothing
Semantics\OptionalArgumentTests.vb (17)
692Dim compilationRef As MetadataReference = libComp.ToMetadataReference() 701Dim metadataRef = MetadataReference.CreateFromImage(libComp.EmitToArray()) 762Dim libRef = MetadataReference.CreateFromImage(libComp.EmitToArray()) 764CompileAndVerify(source, references:=New MetadataReference() {libRef}, expectedOutput:=<![CDATA[ 852Dim metadataRef = MetadataReference.CreateFromImage(libComp.EmitToArray()) 935Dim libRef As MetadataReference = libComp.ToMetadataReference() 937Dim comp = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntimeAndReferences(source, references:=New MetadataReference() {libRef}) 943libRef = MetadataReference.CreateFromImage(libComp.EmitToArray()) 945CompileAndVerify(source, references:=New MetadataReference() {libRef}, expectedOutput:=<![CDATA[ 1007Dim libRef As MetadataReference = libComp.ToMetadataReference() 1009CompileAndVerify(source, references:=New MetadataReference() {libRef}, expectedOutput:=<![CDATA[ 1016libRef = MetadataReference.CreateFromImage(libComp.EmitToArray()) 1018CompileAndVerify(source, references:=New MetadataReference() {libRef}, expectedOutput:=<![CDATA[ 1026references:=New MetadataReference() {libRef}, 1687compilation = CreateEmptyCompilationWithReferences(source, {MscorlibRef_v4_0_30316_17626, MsvbRef, MetadataReference.CreateFromImage(attributeCompilation.EmitToArray())}, TestOptions.ReleaseExe) 1945referencedAssemblies:=New MetadataReference() {MscorlibRef_v4_0_30316_17626}) 1947Dim reference1 = MetadataReference.CreateFromImage(compilation1.EmitToArray())
Semantics\RequiredMembersTests.vb (2)
546}", referencedAssemblies:=DirectCast(Basic.Reference.Assemblies.Net70.References.All, IEnumerable(Of MetadataReference)).Append(originalVbComp.EmitToImageReference())) 1956Dim csharpCompReference As MetadataReference = csharpComp.EmitToImageReference()
Semantics\UseSiteErrorTests.vb (3)
535</compilation>, Enumerable.Empty(Of MetadataReference)()) 566Dim successfulCompilation = CreateCompilationWithMscorlib40AndReferences(sources, New MetadataReference() {unavailableAssemblyReference, csharpAssemblyReference, ilAssemblyReference}) 568Dim failingCompilation = CreateCompilationWithMscorlib40AndReferences(sources, New MetadataReference() {csharpAssemblyReference, ilAssemblyReference})
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (208)
CompilationAPITests.vb (7)
77Dim reference As MetadataReference = If(useMetadataReference, referenceComp.ToMetadataReference(), referenceComp.EmitToImageReference()) 101Dim reference As MetadataReference = GetReference(useMetadataReference, referenceComp) 114Private Shared Function GetReference(useMetadataReference As Boolean, referenceComp As VisualBasicCompilation) As MetadataReference 128Dim reference1 As MetadataReference = GetReference(useMetadataReference, referenceComp1) 129Dim reference2 As MetadataReference = GetReference(useMetadataReference, referenceComp2) 162Dim reference1 As MetadataReference = GetReference(useMetadataReference, referenceComp1) 163Dim reference2 As MetadataReference = GetReference(useMetadataReference, referenceComp2)
DocumentationComments\DocCommentTests.vb (1)
12108Optional additionalRefs As MetadataReference() = Nothing,
SymbolDisplay\SymbolDisplayTests.vb (2)
4664Dim mtref = MetadataReference.CreateFromImage(mtdata) 6046Optional references As IEnumerable(Of MetadataReference) = Nothing)
SymbolsTests\AttributeTests_UnmanagedCallersOnly.vb (1)
15Private ReadOnly _csharpReferences As ImmutableArray(Of MetadataReference) = TargetFrameworkUtil.GetReferences(TargetFramework.Net50)
SymbolsTests\CompilationCreationTests.vb (1)
1990Dim refs = New List(Of MetadataReference)()
SymbolsTests\CorLibrary\CorTypes.vb (1)
83assemblies = MetadataTestHelpers.GetSymbolsForReferences({MetadataReference.CreateFromImage(Net50.Resources.SystemRuntime)})
SymbolsTests\DefaultInterfaceImplementationTests.vb (2)
23Optional additionalReferences As MetadataReference() = Nothing, 11460additionalReferences:=New MetadataReference() {CompilationExtensions.CreateWindowsRuntimeMetadataReference()}).EmitToImageReference()
SymbolsTests\ExtensionMethods\ExtensionMethodTests.vb (4)
211Dim ILRef = MetadataReference.CreateFromImage(ReadFromFile(reference.Path)) 421Dim ILRef = MetadataReference.CreateFromImage(ReadFromFile(reference.Path)) 616Dim ILRef = MetadataReference.CreateFromImage(ReadFromFile(reference.Path)) 810Dim ILRef = MetadataReference.CreateFromImage(ReadFromFile(reference.Path))
SymbolsTests\ExtensionMethods\LookupAndInvocation.vb (1)
3050{MetadataReference.CreateFromImage(verifier.EmittedAssemblyData)},
SymbolsTests\GenericConstraintTests.vb (2)
3260Dim compilation2 = CreateCompilationWithMscorlib40AndReferences(vbSource2, {MetadataReference.CreateFromImage(compilation1.EmitToArray())}) 3298Dim compilation3 = CreateCompilationWithMscorlib40AndReferences(vbSource3, {MetadataReference.CreateFromImage(compilation2.EmitToArray())})
SymbolsTests\InaccessibleOverriding.vb (6)
352Dim proj2Ref = MetadataReference.CreateFromImage(ReadFromFile(proj2ILFile.Path)) 402Dim proj1Ref = MetadataReference.CreateFromImage(ReadFromFile(proj1ILFile.Path)) 483Dim proj2Ref = MetadataReference.CreateFromImage(ReadFromFile(proj2ILFile.Path)) 526Dim proj1Ref = MetadataReference.CreateFromImage(ReadFromFile(proj1ILFile.Path)) 623Dim ilRef = MetadataReference.CreateFromImage(ReadFromFile(reference.Path)) 709Dim ilRef = MetadataReference.CreateFromImage(ReadFromFile(reference.Path))
SymbolsTests\Metadata\MetadataMemberTests.vb (1)
717Dim mtref = MetadataReference.CreateFromImage(mtdata)
SymbolsTests\Metadata\PE\LoadingEvents.vb (1)
62Dim ref = MetadataReference.CreateFromImage(TestResources.General.Regress40025DLL.AsImmutableOrNull())
SymbolsTests\Metadata\PE\LoadingMethods.vb (2)
915Dim longFormRef = MetadataReference.CreateFromImage(TestResources.MetadataTests.Invalid.LongTypeFormInSignature.AsImmutableOrNull()) 945Dim references = {MetadataReference.CreateFromImage(TestResources.SymbolsTests.Metadata.PublicAndPrivateFlags)}
SymbolsTests\Metadata\PE\LoadingWithEvents.vb (2)
26Dim simpleWithEvents = MetadataReference.CreateFromImage(TestResources.SymbolsTests.WithEvents.SimpleWithEvents.AsImmutableOrNull()) 48Dim ref = MetadataReference.CreateFromImage(TestResources.SymbolsTests.WithEvents.SimpleWithEvents.AsImmutableOrNull())
SymbolsTests\Metadata\PE\NoPiaInstantiationOfGenericClassAndStruct.vb (1)
402references:=New List(Of MetadataReference)() From {TestReferences.SymbolsTests.NoPia.NoPIAGenericsAsm1})
SymbolsTests\Metadata\PE\TypeForwarders.vb (3)
1362Dim ref1 = New MetadataReference() { 1366Dim ref2 = New MetadataReference() { 1371Dim ref3 = New MetadataReference() {
SymbolsTests\Metadata\PE\VisualBasicCompilerFeatureRequiredTests.vb (3)
77Protected Overrides Function CreateCompilation(source As XElement, references() As MetadataReference) As VisualBasicCompilation 250Protected Overrides Sub AssertModuleErrors(comp As VisualBasicCompilation, ilRef As MetadataReference) 406Protected Overrides Sub AssertAssemblyErrors(comp As VisualBasicCompilation, ilRef As MetadataReference)
SymbolsTests\Metadata\WinMdEventTest.vb (2)
60Private ReadOnly _eventLibRef As MetadataReference 208Dim dynamicCommonRef As MetadataReference = CreateEmptyCompilationWithReferences(
SymbolsTests\MetadataFileReferenceCompilationTests.vb (2)
20Dim ref = MetadataReference.CreateFromImage({}, filePath:="Goo.dll") 99references:={MetadataReference.CreateFromImage(TestResources.General.C2)},
SymbolsTests\Retargeting\NoPia.vb (37)
571Private Sub CyclicReference(piaRef As MetadataReference, localTypes1Ref As CompilationReference) 1085Dim piaImage = MetadataReference.CreateFromImage(pia.EmitToArray()) 1111Dim localTypes2Image = MetadataReference.CreateFromImage(localTypes2.EmitToArray()) 1114references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), New VisualBasicCompilationReference(pia)}) 1125references:=New MetadataReference() {localTypes2Image, New VisualBasicCompilationReference(pia)}) 1136references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), piaImage}) 1147references:=New MetadataReference() {localTypes2Image, piaImage}) 1177Dim piaImage = MetadataReference.CreateFromImage(pia.EmitToArray()) 1202Dim localTypes2Image = MetadataReference.CreateFromImage(localTypes2.EmitToArray()) 1205references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), New VisualBasicCompilationReference(pia)}) 1216references:=New MetadataReference() {localTypes2Image, New VisualBasicCompilationReference(pia)}) 1227references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), piaImage}) 1238references:=New MetadataReference() {localTypes2Image, piaImage}) 1268Dim piaImage = MetadataReference.CreateFromImage(pia.EmitToArray()) 1293Dim localTypes2Image = MetadataReference.CreateFromImage(localTypes2.EmitToArray()) 1296references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), New VisualBasicCompilationReference(pia)}) 1307references:=New MetadataReference() {localTypes2Image, New VisualBasicCompilationReference(pia)}) 1318references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), piaImage}) 1329references:=New MetadataReference() {localTypes2Image, piaImage}) 1359Dim piaImage = MetadataReference.CreateFromImage(pia.EmitToArray()) 1374references:=New MetadataReference() {New VisualBasicCompilationReference(pia, embedInteropTypes:=True)}) 1378references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), New VisualBasicCompilationReference(pia)}) 1389references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), piaImage}) 1419Dim piaImage = MetadataReference.CreateFromImage(pia.EmitToArray()) 1445Dim localTypes2Image = MetadataReference.CreateFromImage(localTypes2.EmitToArray()) 1448references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), New VisualBasicCompilationReference(pia)}) 1459references:=New MetadataReference() {localTypes2Image, New VisualBasicCompilationReference(pia)}) 1470references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), piaImage}) 1481references:=New MetadataReference() {localTypes2Image, piaImage}) 1512referencedAssemblies:=New MetadataReference() {MscorlibRef}) 1525referencedAssemblies:=New MetadataReference() {MscorlibRef}) 1541referencedAssemblies:=New MetadataReference() {MscorlibRef, pia1Image}) 1543Dim compilation1Image = MetadataReference.CreateFromImage(compilation1.EmitToArray()) 1546references:=New MetadataReference() {compilation1Image, pia1Image}) 1561references:=New MetadataReference() {compilation1Image, pia2Image}) 1722For Each piaRef As MetadataReference In {piaCompilation.EmitToImageReference(), piaCompilation.ToMetadataReference()} 1725For Each consumer1Ref As MetadataReference In {compilation1.EmitToImageReference(), compilation1.ToMetadataReference()}
SymbolsTests\Retargeting\RetargetCustomModifiers.vb (1)
33Dim c2 = VisualBasicCompilation.Create("C2", references:=New MetadataReference() {newMsCorLib, New VisualBasicCompilationReference(c1)})
SymbolsTests\Retargeting\RetargetingCustomAttributes.vb (2)
153Private Shared ReadOnly Property OldMsCorLib As MetadataReference 159Private Shared ReadOnly Property NewMsCorLib As MetadataReference
SymbolsTests\Retargeting\RetargetingTests.vb (2)
3111Dim OldReference As MetadataReference = Nothing 3112Dim OldVBReference As MetadataReference = Nothing
SymbolsTests\Source\BaseClassTests.vb (5)
845New MetadataReference() {NetFramework.mscorlib, ClassAv2, New VisualBasicCompilationReference(Comp)}) 905New MetadataReference() {NetFramework.mscorlib, ClassAv2, New VisualBasicCompilationReference(Comp)}) 979New MetadataReference() {NetFramework.mscorlib, ClassAv1, New VisualBasicCompilationReference(Comp)}) 1108New MetadataReference() {NetFramework.mscorlib, ClassAv1, New VisualBasicCompilationReference(Comp)}) 2208CompilationUtils.CreateCompilationWithMscorlib40AndReferences(c2Source, {MetadataReference.CreateFromImage(compilationImage)}).VerifyDiagnostics()
SymbolsTests\Source\ImplementsTests.vb (18)
3477Dim verifyComp3 As Action(Of MetadataReference, MetadataReference) = 3870Dim reference As MetadataReference = Nothing 3872reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3954Dim reference As MetadataReference = Nothing 3956reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4049Dim reference As MetadataReference = Nothing 4051reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4107Dim reference As MetadataReference = Nothing 4109reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4176Dim reference As MetadataReference = Nothing 4178reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4245Dim reference As MetadataReference = Nothing 4247reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4330Dim reference As MetadataReference = Nothing 4332reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4395Dim reference As MetadataReference = Nothing 4397reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path))
SymbolsTests\Source\OverridesTests.vb (33)
2285</compilation>, references:={New VisualBasicCompilationReference(compilation1), MetadataReference.CreateFromImage(compilation2Bytes)}) 2378</compilation>, references:={New VisualBasicCompilationReference(compilation1), MetadataReference.CreateFromImage(compilation2Bytes)}) 2475</compilation>, references:={MetadataReference.CreateFromImage(compilation1Bytes)}) 2750Dim reference As MetadataReference = Nothing 2752reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3078Dim reference As MetadataReference = Nothing 3080reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3180Dim reference As MetadataReference = Nothing 3182reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3443Dim reference As MetadataReference = Nothing 3445reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3557Dim reference As MetadataReference = Nothing 3559reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3667Dim reference As MetadataReference = Nothing 3669reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3776Dim reference As MetadataReference = Nothing 3778reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3888Dim reference As MetadataReference = Nothing 3890reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3998Dim reference As MetadataReference = Nothing 4000reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4106Dim reference As MetadataReference = Nothing 4108reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4777Dim reference As MetadataReference = Nothing 4779reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4999Dim reference As MetadataReference = Nothing 5001reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 5160Dim reference As MetadataReference = Nothing 5162reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 5428Dim reference As MetadataReference = Nothing 5430reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 5965Dim reference As MetadataReference = Nothing 5967reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path))
SymbolsTests\Source\PropertyTests.vb (7)
2978Dim reference1b = MetadataReference.CreateFromImage(compilation1.EmitToArray()) 3025Dim reference1 = MetadataReference.CreateFromImage(compilation1.EmitToArray()) 3073Dim reference1 = MetadataReference.CreateFromImage(compilation1.EmitToArray()) 3149Dim reference1 = MetadataReference.CreateFromImage(compilation1.EmitToArray()) 3653Dim reference1 = MetadataReference.CreateFromImage(compilation1.EmitToArray()) 7028Dim reference1 = MetadataReference.CreateFromImage(compilation1.EmitToArray()) 8239Private Shared ReadOnly s_propertiesDll As MetadataReference = TestReferences.SymbolsTests.Properties
SymbolsTests\StaticAbstractMembersInInterfacesTests.vb (1)
19Optional additionalReferences As MetadataReference() = Nothing,
SymbolsTests\SymbolErrorTests.vb (1)
6919compilation1 = compilation1.AddReferences(MetadataReference.CreateFromImage(csharpComp.EmitToArray()))
SymbolsTests\WellKnownTypeValidationTests.vb (2)
511Dim refs As MetadataReference() = 682Dim refs As MetadataReference() =
UsedAssembliesTests.vb (54)
70Private Sub VerifyUsedAssemblyReferences(Of TAssemblySymbol As AssemblySymbol)(source2 As BasicTestSource, reference As MetadataReference) 75Private Sub VerifyUsedAssemblyReferences(Of TAssemblySymbol As AssemblySymbol)(source2 As BasicTestSource, reference0 As MetadataReference, reference1 As MetadataReference) 80Private Sub AssertUsedAssemblyReferences(comp As Compilation, expected As MetadataReference(), before As XElement, after As XElement, specificReferencesToAssert As MetadataReference()) 110Private Sub AssertUsedAssemblyReferences(comp As Compilation, ParamArray expected As MetadataReference()) 114Private Sub AssertUsedAssemblyReferences(comp As Compilation, expected As MetadataReference(), specificReferencesToAssert As MetadataReference()) 118Private Function AssertUsedAssemblyReferences(source As BasicTestSource, references As MetadataReference(), ParamArray expected As MetadataReference()) As Compilation 124Private Function AssertUsedAssemblyReferences(source As BasicTestSource, ParamArray references As MetadataReference()) As Compilation 128Private Shared Sub AssertUsedAssemblyReferences(source As BasicTestSource, references As MetadataReference(), expected As XElement) 137Private Function CompileWithUsedAssemblyReferences(source As BasicTestSource, targetFramework As TargetFramework, ParamArray references As MetadataReference()) As ImmutableArray(Of MetadataReference) 141Private Function CompileWithUsedAssemblyReferences(source As BasicTestSource, targetFramework As TargetFramework, options As VisualBasicCompilationOptions, ParamArray references As MetadataReference()) As ImmutableArray(Of MetadataReference) 149Private Function CompileWithUsedAssemblyReferences(comp As Compilation, Optional expectedOutput As String = Nothing, Optional specificReferencesToAssert As MetadataReference() = Nothing) As ImmutableArray(Of MetadataReference) 173Private Function CompileWithUsedAssemblyReferences(source As BasicTestSource, ParamArray references As MetadataReference()) As ImmutableArray(Of MetadataReference) 177Private Function CompileWithUsedAssemblyReferences(source As BasicTestSource, options As VisualBasicCompilationOptions, ParamArray references As MetadataReference()) As ImmutableArray(Of MetadataReference) 221Private Sub Verify_NoReferences_03(Of TAssemblySymbol As AssemblySymbol)(source2 As BasicTestSource, reference As MetadataReference) 255Private Sub Verify_NoReferences_04(Of TAssemblySymbol As AssemblySymbol)(source2 As BasicTestSource, reference As MetadataReference) 378Private Sub Verify_FieldReference_02(Of TAssemblySymbol As AssemblySymbol)(source2 As BasicTestSource, reference0 As MetadataReference, reference1 As MetadataReference) 479Private Function Verify2_FieldReference_03(Of TAssemblySymbol As AssemblySymbol)(source2 As BasicTestSource, reference0 As MetadataReference, reference1 As MetadataReference) As Compilation 485Private Sub Verify3_FieldReference_03(Of TAssemblySymbol As AssemblySymbol)(source3 As BasicTestSource, ParamArray references As MetadataReference()) 555Private Sub VerifyUsedAssemblyReferences(reference As MetadataReference, source As BasicTestSource) 757Private Sub VerifyUsedAssemblyReferences(reference0 As MetadataReference, reference1 As MetadataReference, source As BasicTestSource) 921reference0 As MetadataReference, 922reference1 As MetadataReference, 2034reference As MetadataReference, 3054Sub(source2 As String, ref0 As MetadataReference, ref1 As MetadataReference) 3474Sub(reference0 As MetadataReference, reference1 As MetadataReference, source As String, hasTypeReferencesInImports As Boolean) 3720Sub(reference0 As MetadataReference, 3721reference1 As MetadataReference, 3722reference2 As MetadataReference, 3796Sub(reference0 As MetadataReference, 3797reference1 As MetadataReference, 3798reference2 As MetadataReference, 3902Sub(reference0 As MetadataReference, reference1 As MetadataReference, reference2 As MetadataReference, source As String, namespaceOrdinalReferencedInImports As Integer) 3906Dim compExpected As MetadataReference() 4085Sub(reference0 As MetadataReference, reference1 As MetadataReference, reference2 As MetadataReference, source As String, namespaceOrdinalReferencedInImports As Integer) 4089Dim expected1 As MetadataReference() 4738Dim getReference As Func(Of Compilation, MetadataReference) = Function(c) If(useImageReferences, c.EmitToImageReference(), c.ToMetadataReference())
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (51)
BasicTestBase.vb (14)
33Optional references As MetadataReference() = Nothing, 130Optional references As MetadataReference() = Nothing, 166allReferences As IEnumerable(Of MetadataReference), 208allReferences As IEnumerable(Of MetadataReference), 245Optional allReferences() As MetadataReference = Nothing, 275Optional references() As MetadataReference = Nothing, 303Optional references As IEnumerable(Of MetadataReference) = Nothing, 378Dim reference As MetadataReference = Nothing 380reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 426Optional references As IEnumerable(Of MetadataReference) = Nothing, 879Optional references As IEnumerable(Of MetadataReference) = Nothing, 885Dim allReferences As IEnumerable(Of MetadataReference) = TargetFrameworkUtil.Mscorlib45ExtendedReferences.Add( 900Optional additionalReferences As IEnumerable(Of MetadataReference) = Nothing, 905Dim references As IEnumerable(Of MetadataReference) = TargetFrameworkUtil.Mscorlib45ExtendedReferences.Add(
CompilationTestUtils.vb (28)
27Optional references As IEnumerable(Of MetadataReference) = Nothing, 39Optional references As IEnumerable(Of MetadataReference) = Nothing, 51Optional references As IEnumerable(Of MetadataReference) = Nothing, 114Private Sub AssertSubset(used As ImmutableArray(Of MetadataReference), resolvedReferences As IEnumerable(Of MetadataReference)) 123Optional references As MetadataReference() = Nothing, 140Optional references As IEnumerable(Of MetadataReference) = Nothing, 149Optional references As IEnumerable(Of MetadataReference) = Nothing, 158Optional references As IEnumerable(Of MetadataReference) = Nothing, 170references As IEnumerable(Of MetadataReference), 173Return CreateEmptyCompilationWithReferences(source, {CType(Net40.References.mscorlib, MetadataReference)}.Concat(references), options, parseOptions:=parseOptions) 204Optional additionalRefs As MetadataReference() = Nothing, 210Dim references = {CType(Net40.References.mscorlib, MetadataReference), Net40.References.System, Net40.References.MicrosoftVisualBasic}.Concat(additionalRefs) 228Public ReadOnly XmlReferences As MetadataReference() = {SystemRef, SystemCoreRef, SystemXmlRef, SystemXmlLinqRef} 230Public ReadOnly Net40XmlReferences As MetadataReference() = {Net40.References.SystemCore, Net40.References.SystemXml, Net40.References.SystemXmlLinq} 232Public ReadOnly Net461XmlReferences As MetadataReference() = {Net461.References.SystemCore, Net461.References.SystemXml, Net461.References.SystemXmlLinq} 246Optional references As IEnumerable(Of MetadataReference) = Nothing, 251Dim allReferences = {CType(Net40.References.mscorlib, MetadataReference), Net40.References.System, Net40.References.MicrosoftVisualBasic}.Concat(references) 271Optional references As IEnumerable(Of MetadataReference) = Nothing, 290references As IEnumerable(Of MetadataReference), 318references As IEnumerable(Of MetadataReference), 325references As IEnumerable(Of MetadataReference), 381Optional additionalReferences As IEnumerable(Of MetadataReference) = Nothing, 382<Out> Optional ByRef ilReference As MetadataReference = Nothing, 385Dim references = If(additionalReferences IsNot Nothing, New List(Of MetadataReference)(additionalReferences), New List(Of MetadataReference)) 403Public Function CreateReferenceFromIlCode(ilSource As String, Optional appendDefaultHeader As Boolean = True, <Out> Optional ByRef ilImage As ImmutableArray(Of Byte) = Nothing) As MetadataReference 407Return MetadataReference.CreateFromImage(ilImage)
Extensions.vb (2)
17Public Function GetReferencedAssemblySymbol(compilation As Compilation, reference As MetadataReference) As AssemblySymbol 22Public Function GetReferencedModuleSymbol(compilation As Compilation, reference As MetadataReference) As ModuleSymbol
MetadataHelpers.vb (4)
27Dim refs As New List(Of MetadataReference) 32refs.Add(MetadataReference.CreateFromImage(bytes)) 37refs.Add(MetadataReference.CreateFromImage(CType(r, ImmutableArray(Of Byte)))) 47Dim m = TryCast(r, MetadataReference)
MockVisualBasicCompiler.vb (3)
17Private ReadOnly _additionalReferences As ImmutableArray(Of MetadataReference) 35Public Sub New(responseFile As String, workingDirectory As String, args As String(), Optional analyzers As DiagnosticAnalyzer() = Nothing, Optional generators As ISourceGenerator() = Nothing, Optional additionalReferences As MetadataReference() = Nothing) 39Public Sub New(responseFile As String, buildPaths As BuildPaths, args As String(), Optional analyzers As DiagnosticAnalyzer() = Nothing, Optional generators As ISourceGenerator() = Nothing, Optional additionalReferences As MetadataReference() = Nothing)
Microsoft.CodeAnalysis.Workspaces (76)
FindSymbols\FindReferences\DependentProjectsFinder.cs (1)
332foreach (var reference in project.MetadataReferences)
FindSymbols\FindReferences\DependentTypeFinder.cs (1)
308foreach (var reference in compilation.References)
Serialization\SerializationExtensions.cs (1)
27MetadataReference => WellKnownSynchronizationKind.MetadataReference,
Serialization\SerializerService_Asset.cs (2)
85private void SerializeMetadataReference(MetadataReference reference, ObjectWriter writer) 88private MetadataReference DeserializeMetadataReference(ObjectReader reader)
Serialization\SerializerService_Reference.cs (3)
46private static Checksum CreateChecksum(MetadataReference reference) 90protected virtual void WriteMetadataReferenceTo(MetadataReference reference, ObjectWriter writer) 107protected virtual MetadataReference ReadMetadataReferenceFrom(ObjectReader reader)
Workspace\CommandLineProject.cs (1)
66var unresolvedMetadataReferences = boundMetadataReferences.FirstOrDefault(r => r is UnresolvedMetadataReference);
Workspace\Host\Metadata\MetadataReferenceCache.cs (7)
18internal sealed class MetadataReferenceCache(Func<string, MetadataReferenceProperties, MetadataReference> createReference) 23private readonly Func<string, MetadataReferenceProperties, MetadataReference> _createReference = createReference ?? throw new ArgumentNullException(nameof(createReference)); 25public MetadataReference GetReference(string path, MetadataReferenceProperties properties) 43private readonly Dictionary<MetadataReferenceProperties, WeakReference<MetadataReference>> _references = []; 45public MetadataReference GetAddOrUpdate(string path, MetadataReferenceProperties properties) 49MetadataReference mref = null; 64_references[properties] = new WeakReference<MetadataReference>(mref);
Workspace\Host\Metadata\MetadataServiceFactory.cs (1)
28MetadataReference.CreateFromFile(path, properties, documentationService.GetDocumentationProvider(path)));
Workspace\ProjectSystem\ProjectSystemProject.cs (1)
1368IReadOnlyList<MetadataReference>? originalMetadataReferences = null;
Workspace\Solution\Project.cs (5)
129public IReadOnlyList<MetadataReference> MetadataReferences => State.MetadataReferences; 639public Project AddMetadataReference(MetadataReference metadataReference) 646public Project AddMetadataReferences(IEnumerable<MetadataReference> metadataReferences) 652public Project RemoveMetadataReference(MetadataReference metadataReference) 659public Project WithMetadataReferences(IEnumerable<MetadataReference> metadataReferences)
Workspace\Solution\ProjectChanges.cs (6)
48public IEnumerable<MetadataReference> GetAddedMetadataReferences() 50var oldMetadata = new HashSet<MetadataReference>(OldProject.MetadataReferences); 51foreach (var metadata in NewProject.MetadataReferences) 60public IEnumerable<MetadataReference> GetRemovedMetadataReferences() 62var newMetadata = new HashSet<MetadataReference>(NewProject.MetadataReferences); 63foreach (var metadata in OldProject.MetadataReferences)
Workspace\Solution\ProjectInfo.cs (7)
134public IReadOnlyList<MetadataReference> MetadataReferences { get; } 162IReadOnlyList<MetadataReference> metadataReferences, 196IEnumerable<MetadataReference>? metadataReferences, 224IEnumerable<MetadataReference>? metadataReferences = null, 265IEnumerable<MetadataReference>? metadataReferences = null, 290IReadOnlyList<MetadataReference>? metadataReferences = null, 388public ProjectInfo WithMetadataReferences(IEnumerable<MetadataReference>? metadataReferences)
Workspace\Solution\ProjectState.cs (2)
664public IReadOnlyList<MetadataReference> MetadataReferences => this.ProjectInfo.MetadataReferences; 839public ProjectState WithMetadataReferences(IReadOnlyList<MetadataReference> metadataReferences)
Workspace\Solution\Solution.cs (5)
692public Solution AddMetadataReference(ProjectId projectId, MetadataReference metadataReference) 707public Solution AddMetadataReferences(ProjectId projectId, IEnumerable<MetadataReference> metadataReferences) 715foreach (var metadataReference in collection) 734public Solution RemoveMetadataReference(ProjectId projectId, MetadataReference metadataReference) 756public Solution WithProjectMetadataReferences(ProjectId projectId, IEnumerable<MetadataReference> metadataReferences)
Workspace\Solution\SolutionCompilationState.CompilationTracker.CompilationTrackerState.cs (2)
220Dictionary<MetadataReference, ProjectId>? metadataReferenceToProjectId) 250private static void RecordAssemblySymbols(ProjectId projectId, Compilation compilation, Dictionary<MetadataReference, ProjectId>? metadataReferenceToProjectId)
Workspace\Solution\SolutionCompilationState.cs (5)
689ProjectId projectId, IReadOnlyCollection<MetadataReference> metadataReferences) 698public SolutionCompilationState RemoveMetadataReference(ProjectId projectId, MetadataReference metadataReference) 708ProjectId projectId, IReadOnlyList<MetadataReference> metadataReferences) 1214private async Task<MetadataReference?> GetMetadataReferenceAsync( 1248public Task<MetadataReference?> GetMetadataReferenceAsync(
Workspace\Solution\SolutionCompilationState.ICompilationTracker.cs (2)
30/// of the symbols returned by <see cref="Compilation.GetAssemblyOrModuleSymbol(MetadataReference)"/> for 77Task<MetadataReference?> GetOrBuildSkeletonReferenceAsync(SolutionCompilationState compilationState, MetadataReferenceProperties properties, CancellationToken cancellationToken);
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker.cs (4)
489var newReferences = new List<MetadataReference>(); 490var metadataReferenceToProjectId = new Dictionary<MetadataReference, ProjectId>(); 631void AddMetadataReference(ProjectReference projectReference, MetadataReference? metadataReference) 910public Task<MetadataReference?> GetOrBuildSkeletonReferenceAsync(SolutionCompilationState compilationState, MetadataReferenceProperties properties, CancellationToken cancellationToken)
Workspace\Solution\SolutionCompilationState.RootedSymbolSet.cs (3)
18internal static MetadataReferenceInfo From(MetadataReference reference) 57/// cref="Compilation.GetAssemblyOrModuleSymbol(MetadataReference)"/> for all the references exposed by <see 77foreach (var reference in compilation.References)
Workspace\Solution\SolutionCompilationState.SkeletonReferenceCache.cs (3)
116/// reuse <see cref="MetadataReference"/>s when their dependent semantic version matches ours. In the case 137public readonly MetadataReference? TryGetAlreadyBuiltMetadataReference(MetadataReferenceProperties properties) 140public async Task<MetadataReference?> GetOrBuildReferenceAsync(
Workspace\Solution\SolutionCompilationState.WithFrozenSourceGeneratedDocumentsCompilationTracker.cs (1)
246public Task<MetadataReference?> GetOrBuildSkeletonReferenceAsync(SolutionCompilationState compilationState, MetadataReferenceProperties properties, CancellationToken cancellationToken)
Workspace\Solution\SolutionState.cs (4)
835public StateChange AddMetadataReferences(ProjectId projectId, IReadOnlyCollection<MetadataReference> metadataReferences) 853public StateChange RemoveMetadataReference(ProjectId projectId, MetadataReference metadataReference) 870public StateChange WithProjectMetadataReferences(ProjectId projectId, IReadOnlyList<MetadataReference> metadataReferences) 1363internal bool ContainsMetadataReference(ProjectId projectId, MetadataReference metadataReference)
Workspace\Workspace.cs (9)
906protected internal void OnMetadataReferenceAdded(ProjectId projectId, MetadataReference metadataReference) 918protected internal void OnMetadataReferenceRemoved(ProjectId projectId, MetadataReference metadataReference) 1428foreach (var meta in project.MetadataReferences) 1855foreach (var metadata in projectChanges.GetRemovedMetadataReferences()) 1861foreach (var metadata in projectChanges.GetAddedMetadataReferences()) 2109protected virtual void ApplyMetadataReferenceAdded(ProjectId projectId, MetadataReference metadataReference) 2120protected virtual void ApplyMetadataReferenceRemoved(ProjectId projectId, MetadataReference metadataReference) 2372protected void CheckProjectHasMetadataReference(ProjectId projectId, MetadataReference metadataReference) 2383protected void CheckProjectDoesNotHaveMetadataReference(ProjectId projectId, MetadataReference metadataReference)
Microsoft.CodeAnalysis.Workspaces.MSBuild (15)
MSBuild\MSBuildProjectLoader.Worker_ResolveReferences.cs (12)
24public ImmutableArray<MetadataReference> MetadataReferences { get; } 26public ResolvedReferences(ImmutableHashSet<ProjectReference> projectReferences, ImmutableArray<MetadataReference> metadataReferences) 40/// The full list of <see cref="MetadataReference"/>s. 42private readonly ImmutableArray<MetadataReference> _metadataReferences; 58public ResolvedReferencesBuilder(IEnumerable<MetadataReference> metadataReferences) 66private static ImmutableDictionary<string, HashSet<int>> CreatePathToIndexMap(ImmutableArray<MetadataReference> metadataReferences) 82private static string? GetFilePath(MetadataReference metadataReference) 149foreach (var metadataReference in GetMetadataReferences()) 160private ImmutableArray<MetadataReference> GetMetadataReferences() 162var builder = ImmutableArray.CreateBuilder<MetadataReference>(); 165var _ = PooledHashSet<MetadataReference>.GetInstance(out var set); 169var reference = _metadataReferences[index];
MSBuild\MSBuildWorkspace.cs (3)
570protected override void ApplyMetadataReferenceAdded(ProjectId projectId, MetadataReference metadataReference) 606protected override void ApplyMetadataReferenceRemoved(ProjectId projectId, MetadataReference metadataReference) 625private AssemblyIdentity? GetAssemblyIdentity(ProjectId projectId, MetadataReference metadataReference)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (13)
VisualStudioMSBuildWorkspaceTests.cs (13)
119var p0mscorlib = GetMetadataReference(p0, "mscorlib"); 120var p1mscorlib = GetMetadataReference(p1, "mscorlib"); 149var p1Sys1 = GetMetadataReferenceByAlias(proj1, "Sys1"); 150var p1Sys2 = GetMetadataReferenceByAlias(proj1, "Sys2"); 151var p2Sys1 = GetMetadataReferenceByAlias(proj2, "Sys1"); 152var p2Sys3 = GetMetadataReferenceByAlias(proj2, "Sys3"); 182private static MetadataReference GetMetadataReference(Project project, string name) 187private static MetadataReference GetMetadataReferenceByAlias(Project project, string aliasName) 194private static Metadata GetMetadata(MetadataReference metadataReference) 1902var mtref = MetadataReference.CreateFromImage(metadataBytes); 1925var mtref = MetadataReference.CreateFromImage(metadataBytes); 1949var mtref = MetadataReference.CreateFromImage(metadataBytes); 1972var mtref = MetadataReference.CreateFromImage(metadataBytes);
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (27)
Remote\TestSerializerService.cs (6)
34private static readonly ImmutableDictionary<MetadataReference, string?> s_wellKnownReferenceNames = ImmutableDictionary.Create<MetadataReference, string?>(ReferenceEqualityComparer.Instance) 40private static readonly ImmutableDictionary<string, MetadataReference> s_wellKnownReferences = ImmutableDictionary.Create<string, MetadataReference>() 45protected override void WriteMetadataReferenceTo(MetadataReference reference, ObjectWriter writer) 60protected override MetadataReference ReadMetadataReferenceFrom(ObjectReader reader)
Workspaces\TestHostProject.cs (5)
20params MetadataReference[] references) 30params MetadataReference[] references) 49IEnumerable<MetadataReference> metadataReferences = null, 63IList<MetadataReference> references, 99IEnumerable<MetadataReference> metadataReferences = null,
Workspaces\TestHostProject`1.cs (4)
43public IEnumerable<MetadataReference> MetadataReferences { get; } 95IList<MetadataReference> references, 134IEnumerable<MetadataReference> metadataReferences = null, 152MetadataReferences = metadataReferences ?? new MetadataReference[] { NetFramework.mscorlib };
Workspaces\TestHostSolution.cs (1)
18params MetadataReference[] references)
Workspaces\TestWorkspace.cs (1)
67IList<MetadataReference>? references,
Workspaces\TestWorkspace_XmlConsumption.cs (9)
724private MetadataReference CreateMetadataReferenceFromSource(XElement projectElement, XElement referencedSource) 744var metadataReference = MetadataReference.CreateFromImage(image, new MetadataReferenceProperties(aliases: aliases), includeXmlDocComments ? new DeferredDocumentationProvider(compilation) : null); 780foreach (var reference in CreateReferenceList(referencedSource)) 802private IList<MetadataReference> CreateReferenceList(XElement element) 812references.Add(MetadataReference.CreateFromImage(content, filePath: reference.Value)); 838private IList<MetadataReference> CreateCommonReferences(XElement element) 840var references = new List<MetadataReference>(); 883references = new List<MetadataReference>(TestBase.WinRtRefs.Length); 898references = new List<MetadataReference>(TestBase.PortableRefsMinimal.Length);
Workspaces\TestWorkspace`1.cs (1)
207IList<MetadataReference>? references,
Microsoft.CodeAnalysis.Workspaces.UnitTests (28)
FindReferencesTests.cs (2)
27private static Solution AddProjectWithMetadataReferences(Solution solution, string projectName, string languageName, string code, IEnumerable<MetadataReference> metadataReference, params ProjectId[] projectReferences) 43private static Solution AddProjectWithMetadataReferences(Solution solution, string projectName, string languageName, string code, MetadataReference metadataReference, params ProjectId[] projectReferences)
SolutionTests\ProjectInfoTests.cs (5)
135Assert.Same(metadataReference, ((ImmutableArray<MetadataReference>)info1.MetadataReferences).Single()); 138Assert.True(((ImmutableArray<MetadataReference>)info2.MetadataReferences).IsEmpty); 141Assert.True(((ImmutableArray<MetadataReference>)info3.MetadataReferences).IsEmpty); 144Assert.True(((ImmutableArray<MetadataReference>)info4.MetadataReferences).IsEmpty); 204SolutionTestHelpers.TestListProperty(instance, (old, value) => old.WithMetadataReferences(value), opt => opt.MetadataReferences, (MetadataReference)new TestMetadataReference(), allowDuplicates: false);
SolutionTests\SolutionTests.cs (8)
49private static readonly MetadataReference s_mscorlib = NetFramework.mscorlib; 1160var metadataReference = MetadataReference.CreateFromImage([], filePath: "meta"); 2077var metadataRef = (MetadataReference)new TestMetadataReference(); 2096var solution2 = solution.AddMetadataReferences(projectId, EmptyEnumerable<MetadataReference>()); 2103AssertEx.Equal((MetadataReference[])[metadataRef1, metadataRef2], solution3.GetProject(projectId)!.MetadataReferences); 2126AssertEx.Equal((MetadataReference[])[metadataRef2], solution2.GetProject(projectId)!.MetadataReferences); 2851foreach (var meta in project.MetadataReferences)
SymbolKeyTests.cs (3)
1471private static Compilation GetCompilation(string source, string language, string path = "", MetadataReference[] references = null) 1475MetadataReference.CreateFromFile(typeof(object).Assembly.Location), 1476MetadataReference.CreateFromFile(typeof(Enumerable).Assembly.Location)
UtilityTest\XmlDocumentationProviderTests.cs (1)
36var portableExecutableReference = MetadataReference.CreateFromFile(roslynCompilersLocation, documentation: documentationProvider);
WorkspaceTests\WorkspaceReferenceTests.cs (9)
27metadataReferences: ImmutableArray.Create<MetadataReference>(PortableExecutableReference.CreateFromFile(typeof(object).Assembly.Location))); 56metadataReferences: ImmutableArray.Create<MetadataReference>(PortableExecutableReference.CreateFromFile(typeof(object).Assembly.Location))); 67metadataReferences: ImmutableArray.Create<MetadataReference>(PortableExecutableReference.CreateFromFile(typeof(object).Assembly.Location))); 96metadataReferences: ImmutableArray.Create<MetadataReference>(PortableExecutableReference.CreateFromFile(typeof(object).Assembly.Location))); 107metadataReferences: ImmutableArray.Create<MetadataReference>(PortableExecutableReference.CreateFromFile(typeof(object).Assembly.Location))); 136metadataReferences: ImmutableArray.Create<MetadataReference>(PortableExecutableReference.CreateFromFile(typeof(object).Assembly.Location))); 147metadataReferences: ImmutableArray.Create<MetadataReference>(PortableExecutableReference.CreateFromFile(typeof(object).Assembly.Location))); 180metadataReferences: ImmutableArray.Create<MetadataReference>(PortableExecutableReference.CreateFromFile(typeof(object).Assembly.Location))); 189var forkedProject = project.WithMetadataReferences(ImmutableArray.Create<MetadataReference>(
Microsoft.Gen.ComplianceReports.Unit.Tests (5)
test\Generators\Shared\RoslynTestUtils.cs (5)
61var refs = new List<MetadataReference>(); 64refs.Add(MetadataReference.CreateFromFile(corelib)); 65refs.Add(MetadataReference.CreateFromFile(Path.Combine(runtimeDir, "netstandard.dll"))); 66refs.Add(MetadataReference.CreateFromFile(Path.Combine(runtimeDir, "System.Runtime.dll"))); 73refs.Add(MetadataReference.CreateFromFile(r.Location));
Microsoft.Gen.ContextualOptions.Unit.Tests (5)
test\Generators\Shared\RoslynTestUtils.cs (5)
61var refs = new List<MetadataReference>(); 64refs.Add(MetadataReference.CreateFromFile(corelib)); 65refs.Add(MetadataReference.CreateFromFile(Path.Combine(runtimeDir, "netstandard.dll"))); 66refs.Add(MetadataReference.CreateFromFile(Path.Combine(runtimeDir, "System.Runtime.dll"))); 73refs.Add(MetadataReference.CreateFromFile(r.Location));
Microsoft.Gen.Logging.Unit.Tests (20)
CompilationHelper.cs (12)
22MetadataReference[]? additionalReferences = null, 28var refs = new List<MetadataReference>(); 29refs.Add(MetadataReference.CreateFromFile(corelib)); 30refs.Add(MetadataReference.CreateFromFile(Path.Combine(runtimeDir, "netstandard.dll"))); 31refs.Add(MetadataReference.CreateFromFile(Path.Combine(runtimeDir, "System.Runtime.dll"))); 32refs.Add(MetadataReference.CreateFromFile(typeof(ILogger).Assembly.Location)); 33refs.Add(MetadataReference.CreateFromFile(typeof(LoggerMessageAttribute).Assembly.Location)); 34refs.Add(MetadataReference.CreateFromFile(typeof(IEnrichmentTagCollector).Assembly.Location)); 35refs.Add(MetadataReference.CreateFromFile(typeof(DataClassification).Assembly.Location)); 36refs.Add(MetadataReference.CreateFromFile(typeof(PrivateDataAttribute).Assembly.Location)); 37refs.Add(MetadataReference.CreateFromFile(typeof(BigInteger).Assembly.Location)); 41foreach (MetadataReference reference in additionalReferences)
ParserTests.cs (2)
671MetadataReference[] additionalReferences = { MetadataReference.CreateFromImage(referencedImage) };
SymbolLoaderTests.cs (1)
30Array.Empty<MetadataReference>().ToImmutableArray(),
test\Generators\Shared\RoslynTestUtils.cs (5)
61var refs = new List<MetadataReference>(); 64refs.Add(MetadataReference.CreateFromFile(corelib)); 65refs.Add(MetadataReference.CreateFromFile(Path.Combine(runtimeDir, "netstandard.dll"))); 66refs.Add(MetadataReference.CreateFromFile(Path.Combine(runtimeDir, "System.Runtime.dll"))); 73refs.Add(MetadataReference.CreateFromFile(r.Location));
Microsoft.Gen.Metrics.Unit.Tests (5)
test\Generators\Shared\RoslynTestUtils.cs (5)
61var refs = new List<MetadataReference>(); 64refs.Add(MetadataReference.CreateFromFile(corelib)); 65refs.Add(MetadataReference.CreateFromFile(Path.Combine(runtimeDir, "netstandard.dll"))); 66refs.Add(MetadataReference.CreateFromFile(Path.Combine(runtimeDir, "System.Runtime.dll"))); 73refs.Add(MetadataReference.CreateFromFile(r.Location));
Microsoft.Gen.MetricsReports.Unit.Tests (5)
test\Generators\Shared\RoslynTestUtils.cs (5)
61var refs = new List<MetadataReference>(); 64refs.Add(MetadataReference.CreateFromFile(corelib)); 65refs.Add(MetadataReference.CreateFromFile(Path.Combine(runtimeDir, "netstandard.dll"))); 66refs.Add(MetadataReference.CreateFromFile(Path.Combine(runtimeDir, "System.Runtime.dll"))); 73refs.Add(MetadataReference.CreateFromFile(r.Location));
Microsoft.ML.CodeAnalyzer.Tests (5)
Helpers\AdditionalMetadataReferences.cs (5)
25internal static readonly MetadataReference MSDataDataViewReference = RefFromType<IDataView>(); 26internal static readonly MetadataReference MLNetCoreReference = RefFromType<IHostEnvironment>(); 27internal static readonly MetadataReference MLNetDataReference = RefFromType<MLContext>(); 29internal static MetadataReference RefFromType<TType>() 33return MetadataReference.CreateFromFile(location, documentation: documentationProvider);
Microsoft.VisualStudio.LanguageServices (15)
Library\ObjectBrowser\AbstractListItemFactory.cs (4)
492foreach (var reference in project.MetadataReferences) 522foreach (var reference in project.MetadataReferences) 618foreach (var reference in project.MetadataReferences) 653foreach (var reference in compilation.References)
Library\ObjectBrowser\Lists\ReferenceListItem.cs (2)
16public ReferenceListItem(ProjectId projectId, string name, MetadataReference reference) 38public MetadataReference MetadataReference { get; }
Library\VsNavInfo\NavInfoFactory.cs (1)
24public IVsNavInfo CreateForReference(MetadataReference reference)
Preview\ReferenceChange.MetadataReferenceChange.cs (2)
15private readonly MetadataReference _reference; 17public MetadataReferenceChange(MetadataReference reference, ProjectId projectId, string projectName, bool isAdded, PreviewEngine engine)
ProjectSystem\MiscellaneousFilesWorkspace.cs (2)
53private readonly ImmutableArray<MetadataReference> _metadataReferences; 131private IEnumerable<MetadataReference> CreateMetadataReferences()
ProjectSystem\VisualStudioWorkspaceImpl.AddMetadataReferenceUndoUnit.cs (1)
43reference = MetadataReference.CreateFromFile(_filePath, documentation: documentationProvider.GetDocumentationProvider(_filePath));
ProjectSystem\VisualStudioWorkspaceImpl.cs (3)
561private static string? GetMetadataPath(MetadataReference metadataReference) 572ProjectId projectId, MetadataReference metadataReference) 598ProjectId projectId, MetadataReference metadataReference)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
ProjectSystemShim\TempPECompilerServiceTests.cs (1)
46return MetadataReference.CreateFromFile(resolvedPath, properties);
Microsoft.VisualStudio.LanguageServices.UnitTests (1)
ReferenceManager\VisualStudioMetadataReferenceManagerTests.vb (1)
44WellKnownSynchronizationKind.MetadataReference, reader, cancellationToken:=Nothing), MetadataReference)
Mvc.Analyzers.Test (8)
AttributesShouldNotBeAppliedToPageModelAnalyzerTest.cs (1)
388public AttributesShouldNotBeAppliedToPageModelCSharpAnalzyerTest(ImmutableArray<MetadataReference> metadataReferences)
AvoidHtmlPartialAnalyzerTest.cs (1)
427public AvoidHtmlPartialCSharpAnalzyerTest(ImmutableArray<MetadataReference> metadataReferences)
src\Shared\AnalyzerTesting\TestReferences.cs (4)
16public static ImmutableArray<MetadataReference> MetadataReferences { get; } = GetMetadataReferences(); 18private static ImmutableArray<MetadataReference> GetMetadataReferences() 22var references = ImmutableArray.CreateBuilder<MetadataReference>(); 56references.Add(MetadataReference.CreateFromFile(assemblyPath));
TagHelpersInCodeBlocksAnalyzerTest.cs (1)
913public TagHelpersInCodeBlocksCSharpAnalzyerTest(ImmutableArray<MetadataReference> metadataReferences)
TopLevelParameterNameAnalyzerTest.cs (1)
601public TopLevelParameterNameCSharpAnalyzerTest(ImmutableArray<MetadataReference> metadataReferences)
Mvc.Api.Analyzers.Test (1)
Infrastructure\MvcDiagnosticAnalyzerRunner.cs (1)
39project = project.AddMetadataReference(MetadataReference.CreateFromFile(assembly));
Roslyn.VisualStudio.Next.UnitTests (4)
Remote\SerializationValidator.cs (1)
160await VerifyAssetSerializationAsync<MetadataReference>(
Remote\SnapshotSerializationTests.cs (1)
58.AddMetadataReference(MetadataReference.CreateFromFile(typeof(object).Assembly.Location))
Services\ServiceHubServicesTests.cs (2)
361metadataReferences: [MetadataReference.CreateFromFile(file.Path)]) 1728.AddMetadataReference(MetadataReference.CreateFromFile(typeof(object).Assembly.Location))
SemanticSearch.BuildTask (1)
GenerateFilteredReferenceAssembliesTask.cs (1)
281var metadataRef = MetadataReference.CreateFromStream(readableStream);
SemanticSearch.BuildTask.UnitTests (3)
GenerateFilteredReferenceAssembliesTaskTests.cs (3)
121var libRef = MetadataReference.CreateFromImage(libImage); 166var libRef = MetadataReference.CreateFromImage(libImage); 208var libRef = MetadataReference.CreateFromImage(libImage);
StackDepthTest (2)
Program.cs (2)
80var reference = MetadataReference.CreateFromFile(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\mscorlib.dll"); 81var comp = CSharpCompilation.Create("assemblyName", new SyntaxTree[] { tree }, references: new MetadataReference[] { reference }, options: options);
System.Windows.Forms.Design.Tests (5)
System\Resources\Tools\CodeDomCompileHelper.cs (5)
19private static MetadataReference[] References { get; } = CreateReferences(); 21private static MetadataReference[] CreateReferences() 26MetadataReference.CreateFromFile(corelibPath), 27MetadataReference.CreateFromFile(Path.Join(Path.GetDirectoryName(corelibPath), "System.Runtime.dll")), 28MetadataReference.CreateFromFile(typeof(Bitmap).Assembly.Location),
System.Windows.Forms.PrivateSourceGenerators.Tests (2)
EnumValidationTests.cs (2)
293List<MetadataReference> references = []; 299references.Add(MetadataReference.CreateFromFile(assembly.Location));
WinShimmer (3)
Program.cs (3)
46MetadataReference.CreateFromFile(typeof(object).Assembly.Location), 47MetadataReference.CreateFromFile(typeof(Enumerable).Assembly.Location), 48MetadataReference.CreateFromFile(typeof(ProcessStartInfo).Assembly.Location)