67 instantiations of MetadataReferenceProperties
BuildValidator (1)
LocalReferenceResolver.cs (1)
137properties: new MetadataReferenceProperties(
Microsoft.CodeAnalysis (7)
MetadataReference\AssemblyMetadata.cs (1)
454return new MetadataImageReference(this, new MetadataReferenceProperties(MetadataImageKind.Assembly, aliases, embedInteropTypes), documentation, filePath, display);
MetadataReference\CompilationReference.cs (1)
44return new MetadataReferenceProperties(MetadataImageKind.Assembly, aliases, embedInteropTypes);
MetadataReference\MetadataReferenceProperties.cs (5)
25public static MetadataReferenceProperties Module => new MetadataReferenceProperties(MetadataImageKind.Module); 30public static MetadataReferenceProperties Assembly => new MetadataReferenceProperties(MetadataImageKind.Assembly); 100return new MetadataReferenceProperties(_kind, aliases, _embedInteropTypes, HasRecursiveAliases); 109return new MetadataReferenceProperties(_kind, _aliases, embedInteropTypes, HasRecursiveAliases); 117return new MetadataReferenceProperties(_kind, _aliases, _embedInteropTypes, value);
Microsoft.CodeAnalysis.CSharp (1)
CommandLine\CSharpCommandLineParser.cs (1)
1955var properties = new MetadataReferenceProperties(MetadataImageKind.Assembly, aliases, embedInteropTypes);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Compilation\ReferenceManagerTests.cs (2)
927var m1 = MetadataReference.CreateFromFile(p1, new MetadataReferenceProperties(MetadataImageKind.Module)); 928var m2 = MetadataReference.CreateFromFile(p2, new MetadataReferenceProperties(MetadataImageKind.Module));
Microsoft.CodeAnalysis.UnitTests (31)
MetadataReferences\MetadataReferencePropertiesTests.cs (20)
20var m = new MetadataReferenceProperties(); 25m = new MetadataReferenceProperties(MetadataImageKind.Assembly, aliases: ImmutableArray.Create("\\/[.'\":_)??\t\n*#$@^%*&)", "goo"), embedInteropTypes: true); 30m = new MetadataReferenceProperties(MetadataImageKind.Module); 35Assert.Equal(MetadataReferenceProperties.Module, new MetadataReferenceProperties(MetadataImageKind.Module, ImmutableArray<string>.Empty, false)); 36Assert.Equal(MetadataReferenceProperties.Assembly, new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray<string>.Empty, false)); 42Assert.Throws<ArgumentOutOfRangeException>(() => new MetadataReferenceProperties((MetadataImageKind)byte.MaxValue)); 43Assert.Throws<ArgumentException>(() => new MetadataReferenceProperties(MetadataImageKind.Module, ImmutableArray.Create("blah"))); 44Assert.Throws<ArgumentException>(() => new MetadataReferenceProperties(MetadataImageKind.Module, embedInteropTypes: true)); 45Assert.Throws<ArgumentException>(() => new MetadataReferenceProperties(MetadataImageKind.Module, ImmutableArray.Create(""))); 46Assert.Throws<ArgumentException>(() => new MetadataReferenceProperties(MetadataImageKind.Module, ImmutableArray.Create("x\0x"))); 56var a = new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("a"), embedInteropTypes: true); 58Assert.Equal(a.WithAliases(null), new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray<string>.Empty, embedInteropTypes: true)); 59Assert.Equal(a.WithAliases(default(ImmutableArray<string>)), new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray<string>.Empty, embedInteropTypes: true)); 60Assert.Equal(a.WithAliases(ImmutableArray<string>.Empty), new MetadataReferenceProperties(MetadataImageKind.Assembly, default(ImmutableArray<string>), embedInteropTypes: true)); 61Assert.Equal(a.WithAliases(new string[0]), new MetadataReferenceProperties(MetadataImageKind.Assembly, default(ImmutableArray<string>), embedInteropTypes: true)); 62Assert.Equal(a.WithAliases(new[] { "goo", "aaa" }), new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("goo", "aaa"), embedInteropTypes: true)); 63Assert.Equal(a.WithEmbedInteropTypes(false), new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("a"), embedInteropTypes: false)); 66var m = new MetadataReferenceProperties(MetadataImageKind.Module); 67Assert.Equal(m.WithAliases(default(ImmutableArray<string>)), new MetadataReferenceProperties(MetadataImageKind.Module, default(ImmutableArray<string>), embedInteropTypes: false)); 68Assert.Equal(m.WithEmbedInteropTypes(false), new MetadataReferenceProperties(MetadataImageKind.Module, default(ImmutableArray<string>), embedInteropTypes: false));
MetadataReferences\MetadataReferenceTests.cs (11)
52Assert.Throws<ArgumentException>(() => MetadataReference.CreateFromAssemblyInternal(typeof(object).Assembly, new MetadataReferenceProperties(MetadataImageKind.Module))); 195var props = new MetadataReferenceProperties(MetadataImageKind.Module); 225var r = (PortableExecutableReference)MetadataReference.CreateFromAssemblyInternal(assembly, new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("a", "b"), embedInteropTypes: true), documentation: doc); 274var r3 = r.WithProperties(new MetadataReferenceProperties(MetadataImageKind.Module)); 277var r4 = r.WithProperties(new MetadataReferenceProperties(MetadataImageKind.Assembly)); 325var r5 = r.WithProperties(new MetadataReferenceProperties(MetadataImageKind.Module)); 330var r6 = r.WithProperties(new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("x"), embedInteropTypes: true)); 358var r3 = r.WithProperties(new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("x"), embedInteropTypes: true)); 364Assert.Throws<ArgumentException>(() => r.WithProperties(new MetadataReferenceProperties(MetadataImageKind.Module))); 389var r3 = r.WithProperties(new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("x"), embedInteropTypes: true)); 395Assert.Throws<ArgumentException>(() => r.WithProperties(new MetadataReferenceProperties(MetadataImageKind.Module)));
Microsoft.CodeAnalysis.VisualBasic (9)
CommandLine\VisualBasicCommandLineParser.vb (9)
678Function(path) New CommandLineReference(path, New MetadataReferenceProperties(MetadataImageKind.Module)))) 1330New CommandLineReference(systemDllPath, New MetadataReferenceProperties(MetadataImageKind.Assembly))) 1343New CommandLineReference(msVbDllPath, New MetadataReferenceProperties(MetadataImageKind.Assembly))) 1346metadataReferences.Add(New CommandLineReference(vbRuntimePath, New MetadataReferenceProperties(MetadataImageKind.Assembly))) 1546Return New CommandLineReference(systemRuntimePath, New MetadataReferenceProperties(MetadataImageKind.Assembly)) 1555Return New CommandLineReference(systemRuntimePath, New MetadataReferenceProperties(MetadataImageKind.Assembly)) 1563Return New CommandLineReference(msCorLibPath, New MetadataReferenceProperties(MetadataImageKind.Assembly)) 1568Return New CommandLineReference(msCorLibPath, New MetadataReferenceProperties(MetadataImageKind.Assembly)) 1690Select(Function(path) New CommandLineReference(path, New MetadataReferenceProperties(MetadataImageKind.Assembly, embedInteropTypes:=embedInteropTypes)))
Microsoft.CodeAnalysis.Workspaces (3)
Serialization\SerializerService_Reference.cs (1)
318return new MetadataReferenceProperties(kind, aliases, embedInteropTypes);
Workspace\ProjectSystem\ProjectSystemProjectFactory.cs (1)
659new MetadataReferenceProperties(
Workspace\Solution\SolutionCompilationState.cs (1)
1234var properties = new MetadataReferenceProperties(aliases: projectReference.Aliases, embedInteropTypes: projectReference.EmbedInteropTypes);
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
Workspaces\TestWorkspace_XmlConsumption.cs (1)
744var metadataReference = MetadataReference.CreateFromImage(image, new MetadataReferenceProperties(aliases: aliases), includeXmlDocComments ? new DeferredDocumentationProvider(compilation) : null);
Microsoft.VisualStudio.LanguageServices.CSharp (1)
ProjectSystemShim\CSharpProjectShim.ICSharpProjectSite.cs (1)
75ProjectSystemProject.AddMetadataReference(filename, new MetadataReferenceProperties(embedInteropTypes: embedInteropTypes));
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (5)
ProjectSystemShim\CPS\CSharpReferencesTests.cs (5)
37project3.AddProjectReference(project1, new MetadataReferenceProperties()); 40project3.AddMetadataReference(@"c:\project2.dll", new MetadataReferenceProperties()); 43project3.AddProjectReference(project4, new MetadataReferenceProperties()); 47project3.AddMetadataReference(metadaRefFilePath, new MetadataReferenceProperties(embedInteropTypes: true)); 100project2.AddMetadataReference(@"c:\project1.dll", new MetadataReferenceProperties());
Microsoft.VisualStudio.LanguageServices.UnitTests (5)
ProjectSystemShim\VisualStudioProjectTests\MetadataToProjectReferenceConversionTests.vb (4)
200referencingProject.AddMetadataReference(ReferencePath, New MetadataReferenceProperties(aliases:=ImmutableArray.Create("alias1"))) 208referencingProject.AddMetadataReference(ReferencePath, New MetadataReferenceProperties(aliases:=ImmutableArray.Create("alias2"))) 212referencingProject.RemoveMetadataReference(ReferencePath, New MetadataReferenceProperties(aliases:=ImmutableArray.Create("alias2"))) 217referencingProject.RemoveMetadataReference(ReferencePath, New MetadataReferenceProperties(aliases:=ImmutableArray.Create("alias1")))
ReferenceManager\VisualStudioMetadataReferenceManagerTests.vb (1)
62MyBase.New(New MetadataReferenceProperties(), fullPath)
Microsoft.VisualStudio.LanguageServices.VisualBasic (1)
ProjectSystemShim\VisualBasicProject.vb (1)
73ProjectSystemProject.AddMetadataReference(wszFileName, New MetadataReferenceProperties(embedInteropTypes:=True))
281 references to MetadataReferenceProperties
Microsoft.CodeAnalysis (64)
CommandLine\CommandLineReference.cs (3)
18private readonly MetadataReferenceProperties _properties; 20public CommandLineReference(string reference, MetadataReferenceProperties properties) 38public MetadataReferenceProperties Properties
CommandLine\CommonCompiler.cs (1)
209internal virtual Func<string, MetadataReferenceProperties, PortableExecutableReference> GetMetadataProvider()
CommandLine\CommonCompiler.ExistingReferencesResolver.cs (1)
44public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string? baseFilePath, MetadataReferenceProperties properties)
CommandLine\CommonCompiler.LoggingMetadataFileReferenceResolver.cs (3)
17private readonly Func<string, MetadataReferenceProperties, PortableExecutableReference> _provider; 19public LoggingMetadataFileReferenceResolver(RelativePathResolver pathResolver, Func<string, MetadataReferenceProperties, PortableExecutableReference> provider, TouchedFileLogger? logger) 29public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string? baseFilePath, MetadataReferenceProperties properties)
Compilation\DeterministicKeyBuilder.cs (1)
366static void writeMetadataReferenceProperties(JsonWriter writer, MetadataReferenceProperties properties)
Emit\CommonPEModuleBuilder.cs (1)
472if (alias != MetadataReferenceProperties.GlobalAlias && aliases.IndexOf(alias, 0, i) < 0)
MetadataReference\CompilationReference.cs (6)
21internal CompilationReference(MetadataReferenceProperties properties) 27internal static MetadataReferenceProperties GetProperties(Compilation compilation, ImmutableArray<string> aliases, bool embedInteropTypes) 70/// <param name="value">The new value for <see cref="MetadataReferenceProperties.EmbedInteropTypes"/>.</param> 82public new CompilationReference WithProperties(MetadataReferenceProperties properties) 97internal sealed override MetadataReference WithPropertiesImplReturningMetadataReference(MetadataReferenceProperties properties) 107internal abstract CompilationReference WithPropertiesImpl(MetadataReferenceProperties properties);
MetadataReference\MetadataImageReference.cs (2)
21internal MetadataImageReference(Metadata metadata, MetadataReferenceProperties properties, DocumentationProvider? documentation, string? filePath, string? display) 39protected override PortableExecutableReference WithPropertiesImpl(MetadataReferenceProperties properties)
MetadataReference\MetadataReference.cs (16)
25public MetadataReferenceProperties Properties { get; } 27protected MetadataReference(MetadataReferenceProperties properties) 58/// <param name="value">The new value for <see cref="MetadataReferenceProperties.EmbedInteropTypes"/>.</param> 80public MetadataReference WithProperties(MetadataReferenceProperties properties) 90internal abstract MetadataReference WithPropertiesImplReturningMetadataReference(MetadataReferenceProperties properties); 121MetadataReferenceProperties properties = default, 159MetadataReferenceProperties properties = default, 201MetadataReferenceProperties properties = default, 243MetadataReferenceProperties properties = default, 255MetadataReferenceProperties properties, 268MetadataReferenceProperties properties, 306return CreateFromAssemblyInternal(assembly, default(MetadataReferenceProperties)); 316/// <exception cref="ArgumentException"><paramref name="properties"/>.<see cref="MetadataReferenceProperties.Kind"/> is not <see cref="MetadataImageKind.Assembly"/>.</exception> 329MetadataReferenceProperties properties, 337MetadataReferenceProperties properties) 365MetadataReferenceProperties properties,
MetadataReference\MetadataReferenceProperties.cs (18)
16public struct MetadataReferenceProperties : IEquatable<MetadataReferenceProperties> 25public static MetadataReferenceProperties Module => new MetadataReferenceProperties(MetadataImageKind.Module); 30public static MetadataReferenceProperties Assembly => new MetadataReferenceProperties(MetadataImageKind.Assembly); 82/// Returns <see cref="MetadataReferenceProperties"/> with specified aliases. 87public MetadataReferenceProperties WithAliases(IEnumerable<string> aliases) 93/// Returns <see cref="MetadataReferenceProperties"/> with specified aliases. 98public MetadataReferenceProperties WithAliases(ImmutableArray<string> aliases) 104/// Returns <see cref="MetadataReferenceProperties"/> with <see cref="EmbedInteropTypes"/> set to specified value. 107public MetadataReferenceProperties WithEmbedInteropTypes(bool embedInteropTypes) 113/// Returns <see cref="MetadataReferenceProperties"/> with <see cref="HasRecursiveAliases"/> set to specified value. 115internal MetadataReferenceProperties WithRecursiveAliases(bool value) 161return obj is MetadataReferenceProperties && Equals((MetadataReferenceProperties)obj); 164public bool Equals(MetadataReferenceProperties other) 177public static bool operator ==(MetadataReferenceProperties left, MetadataReferenceProperties right) 182public static bool operator !=(MetadataReferenceProperties left, MetadataReferenceProperties right)
MetadataReference\MetadataReferenceResolver.cs (1)
17public abstract ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string? baseFilePath, MetadataReferenceProperties properties);
MetadataReference\ModuleMetadata.cs (1)
385return new MetadataImageReference(this, MetadataReferenceProperties.Module, documentation, filePath, display);
MetadataReference\PortableExecutableReference.cs (5)
23MetadataReferenceProperties properties, 97/// <param name="value">The new value for <see cref="MetadataReferenceProperties.EmbedInteropTypes"/>.</param> 109public new PortableExecutableReference WithProperties(MetadataReferenceProperties properties) 119internal sealed override MetadataReference WithPropertiesImplReturningMetadataReference(MetadataReferenceProperties properties) 130protected abstract PortableExecutableReference WithPropertiesImpl(MetadataReferenceProperties properties);
MetadataReference\UnresolvedMetadataReference.cs (2)
17internal UnresolvedMetadataReference(string reference, MetadataReferenceProperties properties) 36internal override MetadataReference WithPropertiesImplReturningMetadataReference(MetadataReferenceProperties properties)
ReferenceManager\CommonReferenceManager.Resolution.cs (1)
876var references = compilation.Options.MetadataReferenceResolver.ResolveReference(reference, basePath, MetadataReferenceProperties.Assembly.WithRecursiveAliases(true));
ReferenceManager\CommonReferenceManager.State.cs (1)
724return aliases.Length == 0 || aliases.IndexOf(MetadataReferenceProperties.GlobalAlias, StringComparer.Ordinal) >= 0;
ReferenceManager\MergedAliases.cs (1)
71AddNonIncluded(aliases, MetadataReferenceProperties.GlobalAlias);
Microsoft.CodeAnalysis.CSharp (5)
CommandLine\CSharpCommandLineParser.cs (3)
710metadataReferences.AddRange(ParseSeparatedPaths(value).Select(path => new CommandLineReference(path, MetadataReferenceProperties.Module))); 1406metadataReferences.Insert(0, new CommandLineReference(Path.Combine(sdkDirectory, "mscorlib.dll"), MetadataReferenceProperties.Assembly)); 1955var properties = new MetadataReferenceProperties(MetadataImageKind.Assembly, aliases, embedInteropTypes);
Compilation\CSharpCompilationReference.cs (2)
43private CSharpCompilationReference(CSharpCompilation compilation, MetadataReferenceProperties properties) 49internal override CompilationReference WithPropertiesImpl(MetadataReferenceProperties properties)
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (10)
CommandLineTests.cs (10)
2640Assert.Equal(MetadataReferenceProperties.Assembly, parsedArgs.MetadataReferences[0].Properties); 2643Assert.Equal(MetadataReferenceProperties.Assembly, parsedArgs.MetadataReferences[1].Properties); 2650Assert.Equal(MetadataReferenceProperties.Assembly, parsedArgs.MetadataReferences[0].Properties); 2653Assert.Equal(MetadataReferenceProperties.Assembly.WithEmbedInteropTypes(true), parsedArgs.MetadataReferences[1].Properties); 2660Assert.Equal(MetadataReferenceProperties.Assembly, parsedArgs.MetadataReferences[0].Properties); 2663Assert.Equal(MetadataReferenceProperties.Module, parsedArgs.MetadataReferences[1].Properties); 2670Assert.Equal(MetadataReferenceProperties.Assembly, parsedArgs.MetadataReferences[0].Properties); 2673Assert.Equal(MetadataReferenceProperties.Assembly.WithAliases(new[] { "a" }), parsedArgs.MetadataReferences[1].Properties); 2676Assert.Equal(MetadataReferenceProperties.Assembly.WithAliases(new[] { "b" }).WithEmbedInteropTypes(true), parsedArgs.MetadataReferences[2].Properties); 2679Assert.Equal(MetadataReferenceProperties.Module, parsedArgs.MetadataReferences[3].Properties);
Microsoft.CodeAnalysis.CSharp.Features (2)
AddImport\CSharpAddImportFeatureService.cs (1)
570aliases = metadataReference.Properties.Aliases.Where(a => a != MetadataReferenceProperties.GlobalAlias).ToImmutableArray();
Completion\CompletionProviders\ExternAliasCompletionProvider.cs (1)
78aliases.Remove(MetadataReferenceProperties.GlobalAlias);
Microsoft.CodeAnalysis.CSharp.Scripting (2)
Hosting\CommandLine\Csi.cs (2)
18private readonly Func<string, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference> _createFromFileFunc; 25Func<string, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference>? createFromFileFunc = null)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (20)
Compilation\CompilationAPITests.cs (5)
2175: base(MetadataReferenceProperties.Assembly) 2192protected override PortableExecutableReference WithPropertiesImpl(MetadataReferenceProperties properties) 3101var moduleReference = MetadataReference.CreateFromStream(moduleStream, MetadataReferenceProperties.Module); 3120var moduleReference = MetadataReference.CreateFromStream(moduleStream, MetadataReferenceProperties.Module); 3141var moduleReference = MetadataReference.CreateFromStream(moduleStream, MetadataReferenceProperties.Assembly);
Compilation\CSharpCompilationOptionsTests.cs (1)
433public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties)
Compilation\ReferenceManagerTests.cs (12)
1246public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties) 1305public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties) 2271WithProperties(MetadataReferenceProperties.Assembly.WithAliases(ImmutableArray.Create("Z")).WithRecursiveAliases(true)), 2296WithProperties(MetadataReferenceProperties.Assembly.WithAliases(ImmutableArray.Create("Z")).WithRecursiveAliases(true)), 2330{ "a", (PortableExecutableReference)aRef.WithProperties(MetadataReferenceProperties.Assembly.WithRecursiveAliases(true)) } 2359{ "a", (PortableExecutableReference)aRef.WithProperties(MetadataReferenceProperties.Assembly) } 2397aRef.WithProperties(MetadataReferenceProperties.Assembly.WithAliases(ImmutableArray.Create("Y")).WithRecursiveAliases(true)), 2432aRef.WithProperties(MetadataReferenceProperties.Assembly.WithAliases(ImmutableArray.Create("Y")).WithRecursiveAliases(true)), 2469aRef.WithProperties(MetadataReferenceProperties.Assembly.WithAliases(ImmutableArray.Create("Y")).WithRecursiveAliases(true)), 2470aRef.WithProperties(MetadataReferenceProperties.Assembly.WithAliases(ImmutableArray.Create("Y")).WithRecursiveAliases(true)), 2509aRef.WithProperties(MetadataReferenceProperties.Assembly.WithAliases(ImmutableArray.Create("Y", "Y")).WithRecursiveAliases(true)), 2510dRef.WithProperties(MetadataReferenceProperties.Assembly.WithAliases(ImmutableArray.Create("Z")).WithRecursiveAliases(true)),
Symbols\CompilationCreationTests.cs (2)
2647public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties) 2761public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties)
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
ThrowingMetadataReferenceResolver.cs (1)
31public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string? baseFilePath, MetadataReferenceProperties properties)
Microsoft.CodeAnalysis.EditorFeatures (1)
Interactive\InteractiveSession.cs (1)
187(path, metadataService) => (MetadataReference)metadataService.GetReference(path, MetadataReferenceProperties.Assembly),
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
Completion\AbstractCompletionProviderTests.cs (1)
682var aliases = hasGlobalAlias ? $"{metadataAlias},{MetadataReferenceProperties.GlobalAlias}" : $"{metadataAlias}";
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
EEMetadataReferenceResolver.cs (1)
48public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string? baseFilePath, MetadataReferenceProperties properties)
Microsoft.CodeAnalysis.ExternalAccess.FSharp (2)
VS\IFSharpWorkspaceProjectContextFactory.cs (2)
159_vsProjectContext.AddProjectReference(reference._vsProjectContext, MetadataReferenceProperties.Assembly); 188=> _vsProjectContext.AddMetadataReference(referencePath, MetadataReferenceProperties.Assembly);
Microsoft.CodeAnalysis.Features (3)
AddImport\CodeActions\AssemblyReferenceCodeAction.cs (1)
97var reference = service.GetReference(resolvedPath, MetadataReferenceProperties.Assembly);
Completion\Providers\ImportCompletionProvider\AbstractTypeImportCompletionService.cs (1)
154=> aliases.IsEmpty || aliases.Any(static alias => alias == MetadataReferenceProperties.GlobalAlias);
SemanticSearch\SemanticSearchUtilities.cs (1)
41metadataReferences.Add(metadataService.GetReference(path, MetadataReferenceProperties.Assembly));
Microsoft.CodeAnalysis.InteractiveHost (4)
Interactive\Core\InteractiveHost.Service.cs (2)
320var resolvedReferences = state.ScriptOptions.MetadataResolver.ResolveReference(reference, baseFilePath: null, properties: MetadataReferenceProperties.Assembly); 554var resolvedReferences = rspMetadataResolver.ResolveReference(cmdLineReference.Reference, baseFilePath: null, properties: MetadataReferenceProperties.Assembly);
Interactive\Core\InteractiveHost.ShadowCopyReference.cs (2)
19public ShadowCopyReference(MetadataShadowCopyProvider provider, string originalPath, MetadataReferenceProperties properties) 36protected override PortableExecutableReference WithPropertiesImpl(MetadataReferenceProperties properties)
Microsoft.CodeAnalysis.LanguageServer (3)
HostWorkspace\MetadataService.cs (3)
35public PortableExecutableReference GetReference(string resolvedPath, MetadataReferenceProperties properties) 51public ThrowingExecutableReference(string resolvedPath, MetadataReferenceProperties properties, IOException ex) : base(properties, resolvedPath) 66protected override PortableExecutableReference WithPropertiesImpl(MetadataReferenceProperties properties)
Microsoft.CodeAnalysis.Remote.Workspaces (1)
ProjectSystem\MetadataReferenceInfo.cs (1)
16public MetadataReferenceProperties CreateProperties()
Microsoft.CodeAnalysis.Scripting (24)
Hosting\CommandLine\CommandLineRunner.cs (3)
27private readonly Func<string, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference> _createFromFileFunc; 34Func<string, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference>? createFromFileFunc = null) 185Func<string, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference> createFromFileFunc)
Hosting\Resolvers\RuntimeMetadataReferenceResolver.cs (9)
29private static readonly MetadataReferenceProperties s_resolvedMissingAssemblyReferenceProperties = 30MetadataReferenceProperties.Assembly.WithAliases(ImmutableArray.Create("<implicit>")); 41private readonly Func<string, MetadataReferenceProperties, PortableExecutableReference> _createFromFileFunc; 55Func<string, MetadataReferenceProperties, PortableExecutableReference>? createFromFileFunc = null) 72Func<string, MetadataReferenceProperties, PortableExecutableReference>? createFromFileFunc = null) 86Func<string, MetadataReferenceProperties, PortableExecutableReference>? createFromfileFunc = null) 137private PortableExecutableReference CreateFromFile(string filePath, MetadataReferenceProperties properties) => 143public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string? baseFilePath, MetadataReferenceProperties properties) 198private PortableExecutableReference? ResolveTrustedPlatformAssembly(string name, MetadataReferenceProperties properties)
Script.cs (6)
239internal static readonly MetadataReferenceProperties HostAssemblyReferenceProperties = 240MetadataReferenceProperties.Assembly.WithAliases(ImmutableArray.Create("<host>")).WithRecursiveAliases(true); 315MetadataReferenceProperties properties, 316Func<string, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference> createFromFileFunc) 325/// <see cref="MetadataReference.CreateFromFile(string, PEStreamOptions, MetadataReferenceProperties, DocumentationProvider)"/> 336MetadataReferenceProperties properties) =>
ScriptMetadataResolver.cs (1)
70public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string? baseFilePath, MetadataReferenceProperties properties)
ScriptOptions.cs (5)
143internal Func<string, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference> CreateFromFileFunc { get; private set; } 158Func<string, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference>? createFromFileFunc = null) 199private static readonly MetadataReferenceProperties s_assemblyReferenceProperties = 200MetadataReferenceProperties.Assembly.WithRecursiveAliases(true); 394internal ScriptOptions WithCreateFromFileFunc(Func<string, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference> createFromFileFunc)
Microsoft.CodeAnalysis.Scripting.TestUtilities (4)
ScriptTestBase.cs (1)
42private protected MetadataImageReference CreateFromFile(string filePath, PEStreamOptions options, MetadataReferenceProperties properties)
TestRuntimeMetadataReferenceResolver.cs (3)
17private static readonly MetadataReferenceProperties s_resolvedMissingAssemblyReferenceProperties = MetadataReferenceProperties.Assembly.WithAliases(ImmutableArray.Create("<implicit>")); 47public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties)
Microsoft.CodeAnalysis.Scripting.UnitTests (7)
RuntimeMetadataReferenceResolverTests.cs (7)
37var actualReferences = resolver.ResolveReference("nuget:N/1.0", baseFilePath: null, properties: MetadataReferenceProperties.Assembly); 40actualReferences = resolver.ResolveReference("nuget:N/2.0", baseFilePath: null, properties: MetadataReferenceProperties.Assembly); 43actualReferences = resolver.ResolveReference("_2.dll", baseFilePath: null, properties: MetadataReferenceProperties.Assembly); 46actualReferences = resolver.ResolveReference("_3.dll", baseFilePath: null, properties: MetadataReferenceProperties.Assembly); 55actualReferences = resolver.ResolveReference("nuget:N/1.0", baseFilePath: null, properties: MetadataReferenceProperties.Assembly); 58actualReferences = resolver.ResolveReference("_2.dll", baseFilePath: null, properties: MetadataReferenceProperties.Assembly); 61actualReferences = resolver.ResolveReference("_3.dll", baseFilePath: null, properties: MetadataReferenceProperties.Assembly);
Microsoft.CodeAnalysis.Test.Utilities (8)
Mocks\TestMetadataReference.cs (4)
20: base(MetadataReferenceProperties.Assembly, fullPath) 49protected override PortableExecutableReference WithPropertiesImpl(MetadataReferenceProperties properties) 66: base(MetadataReferenceProperties.Assembly) 90protected override PortableExecutableReference WithPropertiesImpl(MetadataReferenceProperties properties)
Mocks\TestMetadataReferenceResolver.cs (1)
31public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties)
Mocks\TestMissingMetadataReferenceResolver.cs (1)
53public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties) => default(ImmutableArray<PortableExecutableReference>);
Platform\Desktop\DesktopRuntimeUtil.cs (2)
41MetadataReferenceProperties properties = default(MetadataReferenceProperties),
Microsoft.CodeAnalysis.UnitTests (22)
MetadataReferences\MetadataReferencePropertiesTests.cs (8)
20var m = new MetadataReferenceProperties(); 35Assert.Equal(MetadataReferenceProperties.Module, new MetadataReferenceProperties(MetadataImageKind.Module, ImmutableArray<string>.Empty, false)); 36Assert.Equal(MetadataReferenceProperties.Assembly, new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray<string>.Empty, false)); 48Assert.Throws<ArgumentException>(() => MetadataReferenceProperties.Module.WithAliases(ImmutableArray.Create("blah"))); 49Assert.Throws<ArgumentException>(() => MetadataReferenceProperties.Module.WithAliases(new[] { "blah" })); 50Assert.Throws<ArgumentException>(() => MetadataReferenceProperties.Module.WithEmbedInteropTypes(true)); 56var a = new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("a"), embedInteropTypes: true); 66var m = new MetadataReferenceProperties(MetadataImageKind.Module);
MetadataReferences\MetadataReferenceTests.cs (14)
48Assert.Throws<ArgumentNullException>(() => MetadataReference.CreateFromFile(null, default(MetadataReferenceProperties))); 63var properties = explicitProperties ? MetadataReferenceProperties.Assembly : default; 81? MetadataReference.CreateFromImage(peImage.AsImmutable(), MetadataReferenceProperties.Module) 82: MetadataReference.CreateFromImage(peImage.AsEnumerable(), MetadataReferenceProperties.Module); 131explicitProperties ? MetadataReferenceProperties.Assembly : default); 147MetadataReferenceProperties.Module); 164explicitProperties ? MetadataReferenceProperties.Assembly : default); 172var props = new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("a", "b"), embedInteropTypes: true, hasRecursiveAliases: true); 187var r = MetadataReference.CreateFromFile(file.Path, MetadataReferenceProperties.Module); 195var props = new MetadataReferenceProperties(MetadataImageKind.Module); 216var props = new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("a", "b"), embedInteropTypes: true, hasRecursiveAliases: true); 487protected override PortableExecutableReference WithPropertiesImpl(MetadataReferenceProperties properties) 515protected override PortableExecutableReference WithPropertiesImpl(MetadataReferenceProperties properties)
Microsoft.CodeAnalysis.VisualBasic (2)
Compilation\VisualBasicCompilationReference.vb (2)
119Private Sub New(compilation As VisualBasicCompilation, properties As MetadataReferenceProperties) 124Friend Overrides Function WithPropertiesImpl(properties As MetadataReferenceProperties) As CompilationReference
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (1)
CommandLineTests.vb (1)
2514Public Overrides Function ResolveReference(reference As String, baseFilePath As String, properties As MetadataReferenceProperties) As ImmutableArray(Of PortableExecutableReference)
Microsoft.CodeAnalysis.VisualBasic.Scripting (2)
Hosting\CommandLine\Vbi.vb (2)
18Private ReadOnly _createFromFileFunc As Func(Of String, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference) 20Friend Sub New(responseFile As String, buildPaths As BuildPaths, args As String(), analyzerLoader As IAnalyzerAssemblyLoader, Optional createFromFileFunc As Func(Of String, PEStreamOptions, MetadataReferenceProperties, MetadataImageReference) = Nothing)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (2)
Compilation\CompilationAPITests.vb (2)
2425MyBase.New(MetadataReferenceProperties.Assembly) 2439Protected Overrides Function WithPropertiesImpl(properties As MetadataReferenceProperties) As PortableExecutableReference
Microsoft.CodeAnalysis.Workspaces (40)
Serialization\SerializedPortableExecutableReference.cs (2)
28MetadataReferenceProperties properties, 51protected override PortableExecutableReference WithPropertiesImpl(MetadataReferenceProperties properties)
Serialization\SerializerService_Reference.cs (5)
278var properties = ReadMetadataReferencePropertiesFrom(reader); 305private static void WriteTo(MetadataReferenceProperties properties, ObjectWriter writer) 312private static MetadataReferenceProperties ReadMetadataReferencePropertiesFrom(ObjectReader reader) 510MetadataReferenceProperties properties, string? fullPath, DocumentationProvider initialDocumentation) 534protected override PortableExecutableReference WithPropertiesImpl(MetadataReferenceProperties properties)
Workspace\Host\Metadata\IMetadataService.cs (1)
11PortableExecutableReference GetReference(string resolvedPath, MetadataReferenceProperties properties);
Workspace\Host\Metadata\MetadataReferenceCache.cs (5)
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)
Workspace\Host\Metadata\MetadataServiceFactory.cs (1)
30public PortableExecutableReference GetReference(string resolvedPath, MetadataReferenceProperties properties)
Workspace\Host\Metadata\WorkspaceMetadataFileReferenceResolver.cs (1)
28public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties)
Workspace\ProjectSystem\ProjectSystemProject.cs (12)
33private static readonly ImmutableArray<MetadataReferenceProperties> s_defaultMetadataReferenceProperties = [default(MetadataReferenceProperties)]; 51private readonly List<(string path, MetadataReferenceProperties properties)> _metadataReferencesAddedInBatch = []; 52private readonly List<(string path, MetadataReferenceProperties properties)> _metadataReferencesRemovedInBatch = []; 111private readonly Dictionary<string, ImmutableArray<MetadataReferenceProperties>> _allMetadataReferences = []; 666List<(string path, MetadataReferenceProperties properties)> metadataReferencesRemovedInBatch, 667List<(string path, MetadataReferenceProperties properties)> metadataReferencesAddedInBatch) 1196public void AddMetadataReference(string fullPath, MetadataReferenceProperties properties) 1215public bool ContainsMetadataReference(string fullPath, MetadataReferenceProperties properties) 1223private bool ContainsMetadataReference_NoLock(string fullPath, MetadataReferenceProperties properties) 1234public ImmutableArray<MetadataReferenceProperties> GetPropertiesForMetadataReference(string fullPath) 1242public void RemoveMetadataReference(string fullPath, MetadataReferenceProperties properties)
Workspace\ProjectSystem\ProjectSystemProjectFactory.cs (3)
695MetadataReferenceProperties properties, 734MetadataReferenceProperties properties, 814string fullFilePath, MetadataReferenceProperties properties, SolutionServices solutionServices)
Workspace\Solution\SolutionCompilationState.cs (1)
1234var properties = new MetadataReferenceProperties(aliases: projectReference.Aliases, embedInteropTypes: projectReference.EmbedInteropTypes);
Workspace\Solution\SolutionCompilationState.ICompilationTracker.cs (1)
77Task<MetadataReference?> GetOrBuildSkeletonReferenceAsync(SolutionCompilationState compilationState, MetadataReferenceProperties properties, CancellationToken cancellationToken);
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker.cs (1)
910public Task<MetadataReference?> GetOrBuildSkeletonReferenceAsync(SolutionCompilationState compilationState, MetadataReferenceProperties properties, CancellationToken cancellationToken)
Workspace\Solution\SolutionCompilationState.RootedSymbolSet.cs (1)
16internal readonly record struct MetadataReferenceInfo(MetadataReferenceProperties Properties, string? FilePath)
Workspace\Solution\SolutionCompilationState.SkeletonReferenceCache.cs (3)
22/// cref="MetadataReferenceProperties"/> it might be referenced by. Skeletons are used in the compilation tracker 137public readonly MetadataReference? TryGetAlreadyBuiltMetadataReference(MetadataReferenceProperties properties) 143MetadataReferenceProperties properties,
Workspace\Solution\SolutionCompilationState.SkeletonReferenceSet.cs (2)
32private readonly Dictionary<MetadataReferenceProperties, PortableExecutableReference> _referenceMap = []; 36public PortableExecutableReference GetOrCreateMetadataReference(MetadataReferenceProperties properties)
Workspace\Solution\SolutionCompilationState.WithFrozenSourceGeneratedDocumentsCompilationTracker.cs (1)
246public Task<MetadataReference?> GetOrBuildSkeletonReferenceAsync(SolutionCompilationState compilationState, MetadataReferenceProperties properties, CancellationToken cancellationToken)
Microsoft.VisualStudio.LanguageServices (8)
ProjectSystem\CPS\IWorkspaceProjectContext.cs (2)
48void AddMetadataReference(string referencePath, MetadataReferenceProperties properties); 50void AddProjectReference(IWorkspaceProjectContext project, MetadataReferenceProperties properties);
ProjectSystem\MetadataReferences\VisualStudioMetadataReferenceManager.cs (1)
122public PortableExecutableReference CreateMetadataReferenceSnapshot(string filePath, MetadataReferenceProperties properties)
ProjectSystem\MetadataReferences\VisualStudioMetadataReferenceProviderServiceFactory.cs (1)
29public PortableExecutableReference GetReference(string resolvedPath, MetadataReferenceProperties properties)
ProjectSystem\MetadataReferences\VisualStudioPortableExecutableReference.cs (2)
41MetadataReferenceProperties properties, 104protected override PortableExecutableReference WithPropertiesImpl(MetadataReferenceProperties properties)
ProjectSystem\MiscellaneousFilesWorkspace.cs (1)
139select manager.CreateMetadataReferenceSnapshot(fullPath, MetadataReferenceProperties.Assembly);
ProjectSystem\VisualStudioWorkspace.cs (1)
77public PortableExecutableReference CreatePortableExecutableReference(string filePath, MetadataReferenceProperties properties)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (2)
ProjectSystemShim\CPS\CSharpReferencesTests.cs (1)
119project1.AddMetadataReference(project2.BinOutputPath, MetadataReferenceProperties.Assembly);
ProjectSystemShim\TempPECompilerServiceTests.cs (1)
44public PortableExecutableReference GetReference(string resolvedPath, MetadataReferenceProperties properties)
Microsoft.VisualStudio.LanguageServices.UnitTests (21)
ProjectSystemShim\VisualStudioProjectTests\MetadataToProjectReferenceConversionTests.vb (19)
28project2.AddMetadataReference(ReferencePath, MetadataReferenceProperties.Assembly) 43project2.RemoveMetadataReference(ReferencePath, MetadataReferenceProperties.Assembly) 65project2.AddMetadataReference(ReferencePath, MetadataReferenceProperties.Assembly) 80project2.RemoveMetadataReference(ReferencePath, MetadataReferenceProperties.Assembly) 100referencingProject.AddMetadataReference(ReferencePath, MetadataReferenceProperties.Assembly) 136referencingProject.AddMetadataReference(ReferencePath, MetadataReferenceProperties.Assembly) 174referencingProject.AddMetadataReference(ReferencePath, MetadataReferenceProperties.Assembly) 238referencingProject.AddMetadataReference(ReferencePath, MetadataReferenceProperties.Assembly) 263referencingProject.AddMetadataReference(ReferencePath, MetadataReferenceProperties.Assembly.WithAliases(ImmutableArray.Create("temporary"))) 272referencingProject.RemoveMetadataReference(ReferencePath, MetadataReferenceProperties.Assembly.WithAliases(ImmutableArray.Create("temporary"))) 273referencingProject.AddMetadataReference(ReferencePath, MetadataReferenceProperties.Assembly) 297referencingProject.AddMetadataReference(ReferencePath, MetadataReferenceProperties.Assembly) 306referencingProject.RemoveMetadataReference(ReferencePath, MetadataReferenceProperties.Assembly) 307referencingProject.AddMetadataReference(ReferencePath.ToUpper(), MetadataReferenceProperties.Assembly) 325project1.AddMetadataReference(ReferencePath2, MetadataReferenceProperties.Assembly) 326project2.AddMetadataReference(ReferencePath1, MetadataReferenceProperties.Assembly) 349project1.AddMetadataReference(ReferencePath2, MetadataReferenceProperties.Assembly) 350project2.AddMetadataReference(ReferencePath1, MetadataReferenceProperties.Assembly) 367project.AddMetadataReference(ReferencePath, MetadataReferenceProperties.Assembly)
ProjectSystemShim\VisualStudioProjectTests\WorkspaceChangedEventTests.vb (1)
84project.AddMetadataReference("Z:\Test.dll", MetadataReferenceProperties.Assembly)
ReferenceManager\VisualStudioMetadataReferenceManagerTests.vb (1)
77Protected Overrides Function WithPropertiesImpl(properties As MetadataReferenceProperties) As PortableExecutableReference
Microsoft.VisualStudio.LanguageServices.VisualBasic (5)
ProjectSystemShim\TempPECompiler.TempPEProject.vb (1)
42.Select(Function(path) metadataService.GetReference(path, MetadataReferenceProperties.Assembly))
ProjectSystemShim\VisualBasicProject.vb (4)
83ProjectSystemProject.AddMetadataReference(wszFileName, MetadataReferenceProperties.Assembly) 342ProjectSystemProject.RemoveMetadataReference(oldRuntimeLibrary, MetadataReferenceProperties.Assembly) 350If ProjectSystemProject.ContainsMetadataReference(newRuntimeLibrary, MetadataReferenceProperties.Assembly) Then 353ProjectSystemProject.AddMetadataReference(newRuntimeLibrary, MetadataReferenceProperties.Assembly)
VBCSCompiler (13)
src\Compilers\Server\VBCSCompiler\CompilerRequestHandler.cs (2)
46public static Func<string, MetadataReferenceProperties, PortableExecutableReference> SharedAssemblyReferenceProvider { get; } = (path, properties) => new CachingMetadataReference(path, properties); 51private Func<string, MetadataReferenceProperties, PortableExecutableReference> AssemblyReferenceProvider { get; } = SharedAssemblyReferenceProvider;
src\Compilers\Server\VBCSCompiler\CSharpCompilerServer.cs (4)
17private readonly Func<string, MetadataReferenceProperties, PortableExecutableReference> _metadataProvider; 19internal CSharpCompilerServer(Func<string, MetadataReferenceProperties, PortableExecutableReference> metadataProvider, string[] args, BuildPaths buildPaths, string? libDirectory, IAnalyzerAssemblyLoader analyzerLoader, GeneratorDriverCache driverCache) 24internal CSharpCompilerServer(Func<string, MetadataReferenceProperties, PortableExecutableReference> metadataProvider, string? responseFile, string[] args, BuildPaths buildPaths, string? libDirectory, IAnalyzerAssemblyLoader analyzerLoader, GeneratorDriverCache driverCache) 30internal override Func<string, MetadataReferenceProperties, PortableExecutableReference> GetMetadataProvider()
src\Compilers\Server\VBCSCompiler\MetadataCache.cs (3)
56internal Metadata GetMetadata(string fullPath, MetadataReferenceProperties properties) 118public CachingMetadataReference(string fullPath, MetadataReferenceProperties properties) 134protected override PortableExecutableReference WithPropertiesImpl(MetadataReferenceProperties properties)
src\Compilers\Server\VBCSCompiler\VisualBasicCompilerServer.cs (4)
19private readonly Func<string, MetadataReferenceProperties, PortableExecutableReference> _metadataProvider; 21internal VisualBasicCompilerServer(Func<string, MetadataReferenceProperties, PortableExecutableReference> metadataProvider, string[] args, BuildPaths buildPaths, string? libDirectory, IAnalyzerAssemblyLoader analyzerLoader, GeneratorDriverCache driverCache) 26internal VisualBasicCompilerServer(Func<string, MetadataReferenceProperties, PortableExecutableReference> metadataProvider, string? responseFile, string[] args, BuildPaths buildPaths, string? libDirectory, IAnalyzerAssemblyLoader analyzerLoader, GeneratorDriverCache driverCache) 32internal override Func<string, MetadataReferenceProperties, PortableExecutableReference> GetMetadataProvider()