246 references to MetadataImageKind
BuildValidator (1)
Microsoft.CodeAnalysis (62)
MetadataReference\MetadataReference.cs (10)
96/// <param name="properties">Reference properties (extern aliases, type embedding, <see cref="MetadataImageKind"/>).</param>
127MetadataImageKind.Module => ModuleMetadata.CreateFromImage(peImage),
138/// <param name="properties">Reference properties (extern aliases, type embedding, <see cref="MetadataImageKind"/>).</param>
165MetadataImageKind.Module => ModuleMetadata.CreateFromImage(peImage),
177/// <param name="properties">Reference properties (extern aliases, type embedding, <see cref="MetadataImageKind"/>).</param>
208MetadataImageKind.Module => ModuleMetadata.CreateFromStream(peStream, PEStreamOptions.PrefetchEntireImage),
220/// <param name="properties">Reference properties (extern aliases, type embedding, <see cref="MetadataImageKind"/>).</param>
274if (properties.Kind == MetadataImageKind.Module)
316/// <exception cref="ArgumentException"><paramref name="properties"/>.<see cref="MetadataReferenceProperties.Kind"/> is not <see cref="MetadataImageKind.Assembly"/>.</exception>
349if (properties.Kind != MetadataImageKind.Assembly)
ReferenceManager\CommonReferenceManager.Resolution.cs (12)
59private readonly MetadataImageKind _kind;
66public ResolvedReference(int index, MetadataImageKind kind)
77public ResolvedReference(int index, MetadataImageKind kind, ImmutableArray<string> aliasesOpt, ImmutableArray<string> recursiveAliasesOpt, ImmutableArray<MetadataReference> mergedReferences)
139public MetadataImageKind Kind
162return IsSkipped ? "<skipped>" : $"{(_kind == MetadataImageKind.Assembly ? "A" : "M")}[{Index}]:{DisplayAliases(_aliasesOpt, "aliases")}{DisplayAliases(_recursiveAliasesOpt, "recursive-aliases")}";
287case MetadataImageKind.Assembly:
328case MetadataImageKind.Assembly:
370case MetadataImageKind.Module:
416int count = (referenceMap[i].Kind == MetadataImageKind.Assembly) ? assembliesBuilder.Count : lazyModulesBuilder?.Count ?? 0;
439private static ResolvedReference GetResolvedReferenceAndFreePropertyMapEntry(MetadataReference reference, int index, MetadataImageKind kind, Dictionary<MetadataReference, MergedAliases>? propertyMapOpt)
639referenceMap[referenceIndex] = new ResolvedReference(assemblies.Count, MetadataImageKind.Assembly);
653referenceMap[referenceIndex] = new ResolvedReference(modules.Count, MetadataImageKind.Module);
Microsoft.CodeAnalysis.CSharp (4)
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (4)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (17)
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
Microsoft.CodeAnalysis.InteractiveHost (1)
Microsoft.CodeAnalysis.Rebuild (4)
Microsoft.CodeAnalysis.Scripting (9)
Microsoft.CodeAnalysis.Scripting.Desktop.UnitTests (29)
MetadataShadowCopyProviderTests.cs (29)
69Assert.Throws<ArgumentOutOfRangeException>(() => _provider.GetMetadataShadowCopy(IsRunningOnMono ? "/goo.dll" : @"c:\goo.dll", (MetadataImageKind)Byte.MaxValue));
70Assert.Throws<ArgumentNullException>(() => _provider.GetMetadataShadowCopy(null, MetadataImageKind.Assembly));
71Assert.Throws<ArgumentException>(() => _provider.GetMetadataShadowCopy("c:goo.dll", MetadataImageKind.Assembly));
72Assert.Throws<ArgumentException>(() => _provider.GetMetadataShadowCopy("bar.dll", MetadataImageKind.Assembly));
73Assert.Throws<ArgumentException>(() => _provider.GetMetadataShadowCopy(@"\bar.dll", MetadataImageKind.Assembly));
74Assert.Throws<ArgumentException>(() => _provider.GetMetadataShadowCopy(@"../bar.dll", MetadataImageKind.Assembly));
76Assert.Throws<ArgumentOutOfRangeException>(() => _provider.GetMetadata(IsRunningOnMono ? "/goo.dll" : @"c:\goo.dll", (MetadataImageKind)Byte.MaxValue));
77Assert.Throws<ArgumentNullException>(() => _provider.GetMetadata(null, MetadataImageKind.Assembly));
78Assert.Throws<ArgumentException>(() => _provider.GetMetadata("c:goo.dll", MetadataImageKind.Assembly));
88var sc1 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly);
89var sc2 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly);
107var sc1 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly);
116var sc2 = _provider.GetMetadataShadowCopy(mscorlib, MetadataImageKind.Assembly);
127var sc1 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly);
131var sc2 = _provider.GetMetadataShadowCopy(sc1.PrimaryModule.FullPath, MetadataImageKind.Assembly);
144var metadata1 = _provider.GetMetadata(path0, MetadataImageKind.Assembly) as AssemblyMetadata;
166var metadata2 = _provider.GetMetadata(path0, MetadataImageKind.Assembly) as AssemblyMetadata;
173var modifiedMetadata3 = _provider.GetMetadata(path0, MetadataImageKind.Assembly) as AssemblyMetadata;
187Assert.Throws<BadImageFormatException>(() => _provider.GetMetadata(f0, MetadataImageKind.Assembly));
190Assert.Throws<FileNotFoundException>(() => _provider.GetMetadata(f1, MetadataImageKind.Assembly));
200var sc1 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly);
201var sc2 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly);
203var md1 = _provider.GetMetadata(dll.Path, MetadataImageKind.Assembly);
205Assert.Equal(MetadataImageKind.Assembly, md1.Kind);
213var sc3a = _provider.GetMetadataShadowCopy(dll2.Path, MetadataImageKind.Module);
230var sc = provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly);
236sc = provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly);
242sc = provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly);
248sc = provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly);
Microsoft.CodeAnalysis.Test.Utilities (11)
Microsoft.CodeAnalysis.UnitTests (58)
MetadataReferences\MetadataReferencePropertiesTests.cs (23)
23Assert.Equal(MetadataImageKind.Assembly, m.Kind);
25m = new MetadataReferenceProperties(MetadataImageKind.Assembly, aliases: ImmutableArray.Create("\\/[.'\":_)??\t\n*#$@^%*&)", "goo"), embedInteropTypes: true);
28Assert.Equal(MetadataImageKind.Assembly, m.Kind);
30m = new MetadataReferenceProperties(MetadataImageKind.Module);
33Assert.Equal(MetadataImageKind.Module, m.Kind);
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));
64Assert.Equal(a.WithRecursiveAliases(true), new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("a"), embedInteropTypes: true, hasRecursiveAliases: true));
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 (35)
52Assert.Throws<ArgumentException>(() => MetadataReference.CreateFromAssemblyInternal(typeof(object).Assembly, new MetadataReferenceProperties(MetadataImageKind.Module)));
71Assert.Equal(MetadataImageKind.Assembly, r.Properties.Kind);
87Assert.Equal(MetadataImageKind.Module, r.Properties.Kind);
105Assert.Equal(MetadataImageKind.Assembly, r.Properties.Kind);
136Assert.Equal(MetadataImageKind.Assembly, r.Properties.Kind);
152Assert.Equal(MetadataImageKind.Module, r.Properties.Kind);
168Assert.Equal(MetadataImageKind.Assembly, r.Properties.Kind);
172var props = new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("a", "b"), embedInteropTypes: true, hasRecursiveAliases: true);
191Assert.Equal(MetadataImageKind.Module, r.Properties.Kind);
195var props = new MetadataReferenceProperties(MetadataImageKind.Module);
211Assert.Equal(MetadataImageKind.Assembly, r.Properties.Kind);
216var props = new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("a", "b"), embedInteropTypes: true, hasRecursiveAliases: true);
225var r = (PortableExecutableReference)MetadataReference.CreateFromAssemblyInternal(assembly, new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("a", "b"), embedInteropTypes: true), documentation: doc);
228Assert.Equal(MetadataImageKind.Assembly, r.Properties.Kind);
262Assert.Equal(MetadataImageKind.Module, r.Properties.Kind);
274var r3 = r.WithProperties(new MetadataReferenceProperties(MetadataImageKind.Module));
277var r4 = r.WithProperties(new MetadataReferenceProperties(MetadataImageKind.Assembly));
278Assert.Equal(MetadataImageKind.Assembly, r4.Properties.Kind);
301Assert.Equal(MetadataImageKind.Assembly, r.Properties.Kind);
325var r5 = r.WithProperties(new MetadataReferenceProperties(MetadataImageKind.Module));
326Assert.Equal(MetadataImageKind.Module, r5.Properties.Kind);
330var r6 = r.WithProperties(new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("x"), embedInteropTypes: true));
331Assert.Equal(MetadataImageKind.Assembly, r6.Properties.Kind);
344Assert.Equal(MetadataImageKind.Assembly, r.Properties.Kind);
350Assert.Equal(MetadataImageKind.Assembly, r1.Properties.Kind);
356Assert.Equal(MetadataImageKind.Assembly, r2.Properties.Kind);
358var r3 = r.WithProperties(new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("x"), embedInteropTypes: true));
362Assert.Equal(MetadataImageKind.Assembly, r3.Properties.Kind);
364Assert.Throws<ArgumentException>(() => r.WithProperties(new MetadataReferenceProperties(MetadataImageKind.Module)));
375Assert.Equal(MetadataImageKind.Assembly, r.Properties.Kind);
381Assert.Equal(MetadataImageKind.Assembly, r1.Properties.Kind);
387Assert.Equal(MetadataImageKind.Assembly, r2.Properties.Kind);
389var r3 = r.WithProperties(new MetadataReferenceProperties(MetadataImageKind.Assembly, ImmutableArray.Create("x"), embedInteropTypes: true));
393Assert.Equal(MetadataImageKind.Assembly, r3.Properties.Kind);
395Assert.Throws<ArgumentException>(() => r.WithProperties(new MetadataReferenceProperties(MetadataImageKind.Module)));
Microsoft.CodeAnalysis.VisualBasic (14)
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.VisualBasic.CommandLine.UnitTests (4)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (5)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (7)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (2)
Microsoft.CodeAnalysis.Workspaces (10)
Microsoft.VisualStudio.LanguageServices (1)
VBCSCompiler (1)