122 references to MetadataHelpers
Microsoft.CodeAnalysis (56)
CodeGen\PrivateImplementationDetails.cs (1)
141
$"{TypeNamePrefix}<{
MetadataHelpers
.MangleForTypeNameIfNeeded(moduleName)}>" : TypeNamePrefix;
CodeGen\StringTokenMap.cs (2)
41
if (_heapSize >
MetadataHelpers
.UserStringHeapCapacity)
46
_heapSize +=
MetadataHelpers
.GetUserStringBlobSize(value);
CommandLine\CommandLineParser.cs (3)
318
!
MetadataHelpers
.IsValidMetadataIdentifier(outputDirectory) ||
319
!
MetadataHelpers
.IsValidMetadataIdentifier(outputFileName))
443
!
MetadataHelpers
.IsValidAssemblyOrModuleName(outputFileName))
Compilation\Compilation.cs (1)
415
MetadataHelpers
.CheckAssemblyOrModuleName(this.AssemblyName, MessageProvider, MessageProvider.ERR_BadAssemblyName, diagnostics);
Emit\CommonPEModuleBuilder.cs (1)
776
=> names?.Add(
MetadataHelpers
.BuildQualifiedName(type.NamespaceName, Cci.MetadataWriter.GetMetadataName(type, generation: 0)));
Emit\EditAndContinue\DeltaMetadataWriter.cs (1)
147
userStringHeapStartOffset: Math.Min(
MetadataHelpers
.UserStringHeapCapacity, previousGeneration.UserStringStreamLength),
Emit\EmitOptions.cs (1)
356
MetadataHelpers
.CheckAssemblyOrModuleName(OutputNameOverride, messageProvider, messageProvider.ERR_InvalidOutputName, diagnostics);
Emit\NoPia\EmbeddedTypesManager.cs (1)
140
if (namesOfTopLevelTypes.Contains(
MetadataHelpers
.BuildQualifiedName(def.NamespaceName, def.Name)))
MetadataReader\MetadataDecoder.cs (2)
514
Debug.Assert(
MetadataHelpers
.IsValidMetadataIdentifier(name));
637
Debug.Assert(
MetadataHelpers
.IsValidMetadataIdentifier(name));
MetadataReader\MetadataHelpers.cs (1)
1059
fullyQualified[namespaceName.Length] ==
MetadataHelpers
.DotDelimiter &&
MetadataReader\MetadataReaderExtensions.cs (4)
104
if (!
MetadataHelpers
.IsValidMetadataIdentifier(nameStr))
110
if (cultureName != null && !
MetadataHelpers
.IsValidMetadataIdentifier(cultureName))
123
if (!
MetadataHelpers
.IsValidPublicKey(publicKeyOrToken))
144
if (hasPublicKey && !
MetadataHelpers
.IsValidPublicKey(publicKeyOrToken))
MetadataReader\MetadataTypeName.cs (12)
98
forcedArity ==
MetadataHelpers
.InferTypeArityFromMetadataName(fullName),
127
Debug.Assert(!typeName.Contains(
MetadataHelpers
.DotDelimiterString));
130
forcedArity ==
MetadataHelpers
.InferTypeArityFromMetadataName(typeName),
154
Debug.Assert(!typeName.Contains(
MetadataHelpers
.DotDelimiterString) || typeName.IndexOf(
MetadataHelpers
.MangledNameRegionStartChar) >= 0);
158
forcedArity ==
MetadataHelpers
.InferTypeArityFromMetadataName(typeName),
190
_fullName =
MetadataHelpers
.BuildQualifiedName(_namespaceName, _typeName);
205
_typeNameMemory =
MetadataHelpers
.SplitQualifiedName(_fullName, out _namespaceNameMemory);
225
_typeNameMemory =
MetadataHelpers
.SplitQualifiedName(_fullName, out _namespaceNameMemory);
245
_unmangledTypeNameMemory =
MetadataHelpers
.InferTypeArityAndUnmangleMetadataName(TypeNameMemory, out _inferredArity);
281
_unmangledTypeNameMemory =
MetadataHelpers
.InferTypeArityAndUnmangleMetadataName(TypeNameMemory, out _inferredArity);
334
_namespaceSegmentsMemory =
MetadataHelpers
.SplitQualifiedName(NamespaceNameMemory);
MetadataReader\MetadataTypeName.Key.cs (3)
81
return
MetadataHelpers
.SplitNameEqualsFullyQualifiedName(other._namespaceOrFullyQualifiedName, other._typeName, _namespaceOrFullyQualifiedName);
86
return
MetadataHelpers
.SplitNameEqualsFullyQualifiedName(_namespaceOrFullyQualifiedName, _typeName, other._namespaceOrFullyQualifiedName);
110
hashCode = Hash.CombineFNVHash(hashCode,
MetadataHelpers
.DotDelimiter);
MetadataReader\PEModule.cs (4)
394
if (!
MetadataHelpers
.IsValidMetadataFileName(moduleName))
503
return
MetadataHelpers
.BuildQualifiedName(attributeTypeNamespaceName, attributeTypeName);
531
Debug.Assert(name.Length == 0 ||
MetadataHelpers
.IsValidMetadataIdentifier(name)); // Obfuscated assemblies can have types with empty names.
2884
Debug.Assert(
MetadataHelpers
.IsValidMetadataIdentifier(name));
MetadataReader\TypeNameDecoder.cs (6)
55
MetadataHelpers
.AssemblyQualifiedTypeName fullName =
MetadataHelpers
.DecodeTypeName(s);
115
internal TypeSymbol GetTypeSymbol(
MetadataHelpers
.AssemblyQualifiedTypeName fullName, out bool refersToNoPiaLocalType)
157
Debug.Assert(
MetadataHelpers
.IsValidMetadataIdentifier(fullName.TopLevelType));
173
Debug.Assert(
MetadataHelpers
.IsValidMetadataIdentifier(fullName.NestedTypes[i]));
221
private ImmutableArray<KeyValuePair<TypeSymbol, ImmutableArray<ModifierInfo<TypeSymbol>>>> ResolveTypeArguments(
MetadataHelpers
.AssemblyQualifiedTypeName[] arguments, out ImmutableArray<bool> refersToNoPiaLocalType)
MetadataReference\AssemblyIdentity.cs (3)
129
if (!
MetadataHelpers
.IsValidPublicKey(publicKeyOrToken))
167
Debug.Assert((hasPublicKey &&
MetadataHelpers
.IsValidPublicKey(publicKeyOrToken)) || (!hasPublicKey && (publicKeyOrToken.IsDefaultOrEmpty || publicKeyOrToken.Length == PublicKeyTokenSize)));
189
Debug.Assert((hasPublicKey &&
MetadataHelpers
.IsValidPublicKey(publicKeyOrToken)) || (!hasPublicKey && (publicKeyOrToken.IsDefaultOrEmpty || publicKeyOrToken.Length == PublicKeyTokenSize)));
MetadataReference\AssemblyIdentity.DisplayName.cs (1)
669
!
MetadataHelpers
.IsValidPublicKey(key))
PEWriter\MetadataWriter.cs (2)
884
result |=
MetadataHelpers
.GenericParameterAttributesAllowByRefLike;
915
?
MetadataHelpers
.ComposeAritySuffixedMetadataName(nameWithGeneration, namedType.GenericParameterCount, fileIdentifier)
PEWriter\TypeNameSerializer.cs (1)
231
mangledName.Append(
MetadataHelpers
.GetAritySuffix(namedType.GenericParameterCount));
ResourceDescription.cs (2)
74
if (!
MetadataHelpers
.IsValidMetadataIdentifier(resourceName))
86
if (!
MetadataHelpers
.IsValidMetadataFileName(fileName))
StrongName\StrongNameKeys.cs (2)
92
if (
MetadataHelpers
.IsValidPublicKey(publicKey))
144
if (
MetadataHelpers
.IsValidPublicKey(keyFileContent))
Symbols\Attributes\MarshalAsAttributeDecoder.cs (2)
132
if (!
MetadataHelpers
.IsValidUnicodeString(typeName))
148
if (!
MetadataHelpers
.IsValidUnicodeString(cookie))
Microsoft.CodeAnalysis.CSharp (26)
Binder\Binder_Symbols.cs (2)
2765
var metadataName =
MetadataHelpers
.ComposeAritySuffixedMetadataName(name, arity, associatedFileIdentifier: null);
2766
var fullMetadataName =
MetadataHelpers
.BuildQualifiedName(qualifierOpt?.ToDisplayString(SymbolDisplayFormat.QualifiedNameOnlyFormat), metadataName);
CommandLine\CSharpCommandLineParser.cs (1)
619
else if (!
MetadataHelpers
.IsValidAssemblyOrModuleName(value))
CSharpCompilationOptions.cs (1)
687
MetadataHelpers
.CheckAssemblyOrModuleName(ModuleName, MessageProvider.Instance, (int)ErrorCode.ERR_BadModuleName, builder);
Emitter\EditAndContinue\PEDeltaAssemblyBuilder.cs (2)
147
var name =
MetadataHelpers
.InferTypeArityAndUnmangleMetadataName(reader.GetString(def.Name), out _);
168
var name =
MetadataHelpers
.InferTypeArityAndUnmangleMetadataName(reader.GetString(def.Name), out _);
Emitter\Model\PEModuleBuilder.cs (1)
689
string fullEmittedName =
MetadataHelpers
.BuildQualifiedName(
SymbolDisplay\SymbolDisplayVisitor.Types.cs (1)
416
MetadataHelpers
.GetAritySuffix(symbol.Arity)));
Symbols\AnonymousTypes\AnonymousTypeManager.Templates.cs (2)
472
MetadataHelpers
.InferTypeArityAndUnmangleMetadataName(name, out _),
520
moduleId =
MetadataHelpers
.MangleForTypeNameIfNeeded(moduleId);
Symbols\Metadata\PE\PENamedTypeSymbol.cs (3)
349
_name =
MetadataHelpers
.UnmangleMetadataNameForArity(metadataName, arity);
385
_corTypeId = SpecialTypes.GetTypeFromMetadataName(
MetadataHelpers
.BuildQualifiedName(emittedNamespaceName, metadataName));
2522
string emittedName =
MetadataHelpers
.BuildQualifiedName(missingType.NamespaceName, missingType.MetadataName);
Symbols\Metadata\PE\PENamespaceSymbol.cs (1)
226
MetadataHelpers
.GetInfoForImmediateNamespaceMembers(
Symbols\Metadata\PE\PETypeParameterSymbol.cs (1)
575
return (_flags &
MetadataHelpers
.GenericParameterAttributesAllowByRefLike) != 0;
Symbols\MissingMetadataTypeSymbol.cs (3)
246
var namespaces =
MetadataHelpers
.SplitQualifiedName(_namespaceName);
297
string emittedName =
MetadataHelpers
.BuildQualifiedName(_namespaceName, MetadataName);
324
new CSDiagnosticInfo(ErrorCode.ERR_PredefinedTypeNotFound,
MetadataHelpers
.BuildQualifiedName(_namespaceName, MetadataName)) :
Symbols\NamedTypeSymbol.cs (2)
499
?
MetadataHelpers
.ComposeAritySuffixedMetadataName(Name, Arity, fileIdentifier)
1663
ContainingNamespace.Name ==
MetadataHelpers
.SystemString)
Symbols\Source\SourceAssemblySymbol.cs (1)
2841
string fullEmittedName =
MetadataHelpers
.BuildQualifiedName(originalDefinition.ContainingSymbol.ToDisplayString(SymbolDisplayFormat.QualifiedNameOnlyFormat),
Symbols\Source\SourceMemberContainerSymbol.cs (1)
281
emittedName =
MetadataHelpers
.BuildQualifiedName(emittedName, MetadataName);
Symbols\Source\SourceMethodSymbolWithAttributes.cs (2)
851
if (!
MetadataHelpers
.IsValidMetadataIdentifier(moduleName))
880
if (!
MetadataHelpers
.IsValidMetadataIdentifier(importName))
Symbols\Synthesized\GeneratedNames.cs (1)
410
name =
MetadataHelpers
.InferTypeArityAndUnmangleMetadataName(name, out var arity);
Symbols\TypeSymbolExtensions.cs (1)
550
private static readonly string[] s_expressionsNamespaceName = { "Expressions", "Linq",
MetadataHelpers
.SystemString, "" };
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (1)
Emit\GeneratedNamesTests.cs (1)
36
name =
MetadataHelpers
.InferTypeArityAndUnmangleMetadataName(name, out _);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
Extensions.cs (1)
158
builder.Add(
MetadataHelpers
.SplitQualifiedName(part, out part));
Microsoft.CodeAnalysis.Scripting (1)
ScriptBuilder.cs (1)
188
string entryPointTypeName =
MetadataHelpers
.BuildQualifiedName(entryPoint.ContainingNamespace.MetadataName, entryPoint.ContainingType.MetadataName);
Microsoft.CodeAnalysis.UnitTests (37)
MetadataReferences\MetadataHelpersTests.cs (37)
30
Assert.False(
MetadataHelpers
.IsValidMetadataIdentifier(null));
31
Assert.False(
MetadataHelpers
.IsValidMetadataIdentifier(""));
32
Assert.True(
MetadataHelpers
.IsValidMetadataIdentifier("x"));
33
Assert.False(
MetadataHelpers
.IsValidMetadataIdentifier("\0"));
34
Assert.False(
MetadataHelpers
.IsValidMetadataIdentifier("x\0"));
35
Assert.False(
MetadataHelpers
.IsValidMetadataIdentifier("\0x"));
36
Assert.False(
MetadataHelpers
.IsValidMetadataIdentifier("abc\0xyz\0uwq"));
37
Assert.False(
MetadataHelpers
.IsValidMetadataIdentifier(lowSurrogate));
38
Assert.False(
MetadataHelpers
.IsValidMetadataIdentifier(highSurrogate));
39
Assert.True(
MetadataHelpers
.IsValidMetadataIdentifier(highSurrogate + lowSurrogate));
40
Assert.False(
MetadataHelpers
.IsValidMetadataIdentifier(lowSurrogate + highSurrogate));
41
Assert.False(
MetadataHelpers
.IsValidMetadataIdentifier(highSurrogate + "x" + lowSurrogate));
42
Assert.False(
MetadataHelpers
.IsValidMetadataIdentifier(lowSurrogate + "x" + highSurrogate));
43
Assert.False(
MetadataHelpers
.IsValidMetadataIdentifier(highSurrogate + "xxx"));
44
Assert.False(
MetadataHelpers
.IsValidMetadataIdentifier(lowSurrogate + "xxx"));
45
Assert.False(
MetadataHelpers
.IsValidMetadataIdentifier(lowSurrogate + "\0" + highSurrogate));
46
Assert.False(
MetadataHelpers
.IsValidMetadataIdentifier(highSurrogate + "\0" + lowSurrogate));
106
private static string[] GenerateTypeNamesToDecode(TypeNameConfig[] typeNameConfigs, out
MetadataHelpers
.AssemblyQualifiedTypeName[] expectedDecodeNames)
112
expectedDecodeNames = new
MetadataHelpers
.AssemblyQualifiedTypeName[typeNameConfigs.Length];
132
MetadataHelpers
.AssemblyQualifiedTypeName[] expectedTypeArguments;
220
expectedDecodeNames[index] = new
MetadataHelpers
.AssemblyQualifiedTypeName(expectedTopLevelTypeName, expectedNestedTypes, expectedTypeArguments, expectedPointerCount, expectedArrayRanks, expectedAssemblyName);
230
MetadataHelpers
.AssemblyQualifiedTypeName decodedName,
234
MetadataHelpers
.AssemblyQualifiedTypeName[] expectedTypeArguments,
266
MetadataHelpers
.AssemblyQualifiedTypeName[] expectedTypeArguments = null,
270
MetadataHelpers
.AssemblyQualifiedTypeName decodedName =
MetadataHelpers
.DecodeTypeName(nameToDecode);
274
private static void DecodeTypeNamesAndVerify(string[] namesToDecode,
MetadataHelpers
.AssemblyQualifiedTypeName[] expectedDecodedNames)
291
MetadataHelpers
.AssemblyQualifiedTypeName[] expectedDecodedNames;
332
expectedTypeArguments: new[] { new
MetadataHelpers
.AssemblyQualifiedTypeName("W", null, null, 0, null, null) },
339
expectedTypeArguments: new[] { new
MetadataHelpers
.AssemblyQualifiedTypeName(
352
expectedTypeArguments: new[] { new
MetadataHelpers
.AssemblyQualifiedTypeName(
359
new
MetadataHelpers
.AssemblyQualifiedTypeName("W", null, null, 0, null, null) },
394
expectedTypeArguments: new[] { new
MetadataHelpers
.AssemblyQualifiedTypeName("T", null, null, 0, null, "Assembly") },
443
MetadataHelpers
.GetInfoForImmediateNamespaceMembers(
483
MetadataHelpers
.GetInfoForImmediateNamespaceMembers(
495
MetadataHelpers
.GetInfoForImmediateNamespaceMembers(
515
Assert.Equal(builder.Count,
MetadataHelpers
.GetUserStringBlobSize(str));