3 instantiations of SymbolKey
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
SymbolKey\SymbolKeyTestBase.cs (1)
86var deserialized = new SymbolKey(serialized);
Microsoft.CodeAnalysis.Workspaces (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (2)
130=> new(CreateString(symbol, cancellationToken)); 232/// and used later with <see cref="SymbolKey(string)"/> to then try to resolve back
358 references to SymbolKey
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (22)
SymbolKey\SymbolKeyCompilationsTests.cs (2)
532var symkey = SymbolKey.Create(typeSym02, CancellationToken.None);
SymbolKey\SymbolKeyErrorTypeTests.cs (2)
306var symbolKey = SymbolKey.CreateString(symbol); 318var resolution = SymbolKey.ResolveString(symbolKey, emptyCompilation, ignoreAssemblyKey: true, out var failureReason, CancellationToken.None);
SymbolKey\SymbolKeyTestBase.cs (9)
82var sid = SymbolKey.Create(originalSymbol, CancellationToken.None); 86var deserialized = new SymbolKey(serialized); 87var comparer = SymbolKey.GetComparer(ignoreCase: false, ignoreAssemblyKeys: false); 96var sid1 = SymbolKey.Create(symbol1, CancellationToken.None); 97var sid2 = SymbolKey.Create(symbol2, CancellationToken.None); 109var ret = CodeAnalysis.SymbolKey.GetComparer(ignoreCase, ignoreAssemblyIds).Equals(sid2, sid1);
SymbolKey\SymbolKeyTests.cs (9)
49var symbolKey = SymbolKey.Create(type); 88var symbolKey = SymbolKey.Create(type); 94symbolKey = SymbolKey.Create(type); 124var symbolKey = SymbolKey.Create(type); 174var symbolKey = SymbolKey.Create(method);
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
Rename\CSharpRenameRewriterLanguageService.cs (1)
543(Equals(symbol, _renamedSymbol) || SymbolKey.GetComparer(ignoreCase: true, ignoreAssemblyKeys: false).Equals(symbol.GetSymbolKey(), _renamedSymbol.GetSymbolKey())))
Microsoft.CodeAnalysis.EditorFeatures (5)
IntelliSense\NavigationActionFactory.cs (1)
66resolvedSymbolKey = SymbolKey.ResolveString(navigationTarget, compilation, cancellationToken: cancellationToken);
Peek\DefinitionPeekableItem.cs (2)
21private readonly SymbolKey _symbolKey; 27Workspace workspace, ProjectId projectId, SymbolKey symbolKey,
Peek\PeekableItemFactory.cs (2)
82var symbolKey = SymbolKey.Create(symbol, cancellationToken);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (3)
MetadataAsSource\AbstractMetadataAsSourceTests.cs (2)
122var metadataSymbolId = metadataSymbol.GetSymbolKey(); 128Assert.True(SymbolKey.GetComparer(ignoreCase: true, ignoreAssemblyKeys: false).Equals(metadataSymbolId, generatedSymbol.GetSymbolKey()));
SymbolKey\SymbolKeyCrossLanguageTests.cs (1)
54var resolved = SymbolKey.ResolveString(methodSymbol.GetSymbolKey().ToString(), vbCompilation, out var failureReason, CancellationToken.None);
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp (2)
MetadataAsSource\OmniSharpMetadataAsSourceHelpers.cs (2)
21var symbolKey = SymbolKey.Create(symbol, cancellationToken);
Microsoft.CodeAnalysis.Features (144)
Common\TaggedText.cs (1)
125=> symbol is null ? null : SymbolKey.CreateString(symbol);
Completion\Providers\ImportCompletionProvider\AbstractExtensionMethodImportCompletionProvider.cs (1)
64var receiverTypeKey = SymbolKey.CreateString(receiverTypeSymbol, cancellationToken);
Completion\Providers\ImportCompletionProvider\AbstractTypeImportCompletionService.cs (1)
237using var builder = new TypeImportCompletionCacheEntry.Builder(SymbolKey.Create(assembly, cancellationToken), checksum, Language, GenericTypeSuffix, editorBrowsableInfo);
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.cs (3)
71var receiverTypeSymbolKeyData = SymbolKey.CreateString(receiverTypeSymbol, cancellationToken); 72var targetTypesSymbolKeyData = targetTypesSymbols.SelectAsArray(s => SymbolKey.CreateString(s, cancellationToken)); 181SymbolKey.CreateString(bestSymbol, cancellationToken),
Completion\Providers\ImportCompletionProvider\ImportCompletionItem.cs (2)
182if (SymbolKey.ResolveString(methodSymbolKey, compilation).GetAnySymbol() is IMethodSymbol methodSymbol) 189if (SymbolKey.ResolveString(receiverTypeKey, compilation).GetAnySymbol() is ITypeSymbol receiverTypeSymbol)
Completion\Providers\ImportCompletionProvider\TypeImportCompletionCacheEntry.cs (4)
17public SymbolKey AssemblySymbolKey { get; } 39SymbolKey assemblySymbolKey, 146public sealed class Builder(SymbolKey assemblySymbolKey, Checksum checksum, string language, string genericTypeSuffix, EditorBrowsableInfo editorBrowsableInfo) : IDisposable 148private readonly SymbolKey _assemblySymbolKey = assemblySymbolKey;
Completion\Providers\SymbolCompletionItem.cs (2)
124=> SymbolKey.CreateString(symbol); 181=> SymbolKey.ResolveString(id, compilation).GetAnySymbol();
DocumentationComments\AbstractDocumentationCommentFormattingService.cs (1)
465return (target: SymbolKey.CreateString(symbol), hint: symbol.ToMinimalDisplayString(semanticModel, position, format ?? SymbolDisplayFormat.MinimallyQualifiedFormat));
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (40)
2667PooledDictionary<ISymbol, SymbolKey> symbolKeyCache) 2669public SymbolKey GetKey(ISymbol symbol, CancellationToken cancellationToken) 2670=> symbolKeyCache.GetOrAdd(symbol, static (symbol, cancellationToken) => SymbolKey.Create(symbol, cancellationToken), cancellationToken); 2704using var _3 = PooledDictionary<ISymbol, SymbolKey>.GetInstance(out var symbolKeyCache); 2805var containingTypeSymbolKey = symbolCache.GetKey(containingType, cancellationToken); 2853var typeKey = symbolCache.GetKey(newType, cancellationToken); 2938var containingTypeKey = symbolCache.GetKey(oldContainingType, cancellationToken); 3063var containingTypeKey = symbolCache.GetKey(newContainingType, cancellationToken); 3399var containingSymbolKey = symbolCache.GetKey(oldSymbol.ContainingType, cancellationToken); 3422var symbolKey = symbolCache.GetKey(symbol, cancellationToken); 3432: (SymbolKey?)null; 3473var oldContainingTypeKey = SymbolKey.Create(oldContainingType, cancellationToken); 3544var symbolKey = symbolCache.GetKey(newSymbol, cancellationToken); 3586static ISymbol? Resolve(ISymbol symbol, SymbolKey symbolKey, Compilation compilation, CancellationToken cancellationToken) 3698SymbolKey containingTypeKey, 3750SymbolKey containingTypeKey, 3765if (SymbolKey.Create(deconstructor, cancellationToken).Resolve(otherCompilation, ignoreAssemblyKey: true, cancellationToken).Symbol != null) 3870private static void AddDeleteEditsForMemberAndAccessors(ArrayBuilder<SemanticEditInfo> semanticEdits, ISymbol oldSymbol, SymbolKey deletedSymbolContainer, CancellationToken cancellationToken) 3923SymbolKey containingSymbolKey, 3951semanticEdits.Add(SemanticEditInfo.CreateUpdate(SymbolKey.Create(oldSymbol, cancellationToken), syntaxMaps: default, partialType: null)); 4013var newType = SymbolKey.Create(oldType, cancellationToken).Resolve(newModel.Compilation, ignoreAssemblyKey: true, cancellationToken).Symbol; 4044var oldType = SymbolKey.Create(newType, cancellationToken).Resolve(oldModel.Compilation, ignoreAssemblyKey: true, cancellationToken).Symbol; 4136private static readonly IEqualityComparer<SymbolKey> s_symbolKeyComparer = SymbolKey.GetComparer(); 4686var containingSymbolKey = SymbolKey.Create(oldContainingMember.ContainingSymbol, cancellationToken); 4709semanticEdits.Add(SemanticEditInfo.CreateUpdate(SymbolKey.Create(beginInvokeMethod, cancellationToken), syntaxMaps: default, partialType: null)); 4983var symbolKey = SymbolKey.Create(member, cancellationToken); 5128var symbolKey = SymbolKey.Create(oldSymbol, cancellationToken); 5462var typeKey = SymbolKey.Create(newType, cancellationToken); 5463var partialType = isPartialEdit ? typeKey : (SymbolKey?)null; 5497var newCtorKey = SymbolKey.Create(newCtor, cancellationToken); 5638SymbolKey.Create(oldType.InstanceConstructors.Single(c => c.Parameters is []), cancellationToken), 6986var oldConstructor = SymbolKey.Create(newPrimaryConstructor, cancellationToken).Resolve(oldCompilation, ignoreAssemblyKey: true, cancellationToken).Symbol; 6999var oldParameter = SymbolKey.Create(newPrimaryParameter, cancellationToken).Resolve(oldCompilation, ignoreAssemblyKey: true, cancellationToken).Symbol;
EditAndContinue\EditSession.cs (2)
905var symbolKeyComparer = SymbolKey.GetComparer(ignoreCase: false, ignoreAssemblyKeys: true); 906var mergedUpdateEditSyntaxMaps = new Dictionary<SymbolKey, (Func<SyntaxNode, SyntaxNode?>? matchingNodes, Func<SyntaxNode, RuntimeRudeEdit?>? runtimeRudeEdits)>(symbolKeyComparer);
EditAndContinue\SemanticEditInfo.cs (28)
44SymbolKey symbol, 46SymbolKey? partialType, 47SymbolKey? deletedSymbolContainer) 58public static SemanticEditInfo CreateInsert(SymbolKey symbol, SymbolKey? partialType) 64var partialType = symbol.IsPartialImplementation() ? SymbolKey.Create(symbol.ContainingType, cancellationToken) : (SymbolKey?)null; 65return CreateInsert(SymbolKey.Create(symbol, cancellationToken), partialType); 68public static SemanticEditInfo CreateUpdate(SymbolKey symbol, SyntaxMaps syntaxMaps, SymbolKey? partialType) 74var partialType = symbol.IsPartialImplementation() ? SymbolKey.Create(symbol.ContainingType, cancellationToken) : (SymbolKey?)null; 75return CreateUpdate(SymbolKey.Create(symbol, cancellationToken), syntaxMaps, partialType); 78public static SemanticEditInfo CreateReplace(SymbolKey symbol, SymbolKey? partialType) 81public static SemanticEditInfo CreateDelete(SymbolKey symbol, SymbolKey deletedSymbolContainer, SymbolKey? partialType) 84public static SemanticEditInfo CreateDelete(ISymbol symbol, SymbolKey containingSymbolKey, CancellationToken cancellationToken) 87var partialType = symbol.IsPartialImplementation() ? containingSymbolKey : (SymbolKey?)null; 88return CreateDelete(SymbolKey.Create(symbol, cancellationToken), containingSymbolKey, partialType); 101/// We use <see cref="SymbolKey"/> to represent the symbol rather then <see cref="ISymbol"/>, 103/// When the edits are processed we map the <see cref="SymbolKey"/> to the current compilation. 105public SymbolKey Symbol { get; } 110/// We use <see cref="SymbolKey"/> to represent the symbol rather then <see cref="ISymbol"/>, 112/// When the edits are processed we map the <see cref="SymbolKey"/> to the current compilation. 114public SymbolKey? DeletedSymbolContainer { get; } 126public SymbolKey? PartialType { get; }
EncapsulateField\AbstractEncapsulateFieldService.cs (1)
122var fieldSymbolKeys = fields.SelectAsArray(f => SymbolKey.CreateString(f, cancellationToken));
FindUsages\DefinitionItem.cs (1)
42/// metadata-as-source for metadata symbols. We need to store the <see cref="SymbolKey"/>
FindUsages\DefinitionItem.DefaultDefinitionItem.cs (1)
73var symbol = SymbolKey.ResolveString(symbolKey, compilation, cancellationToken: cancellationToken).Symbol;
FindUsages\DefinitionItemFactory.cs (1)
150.Add(DefinitionItem.MetadataSymbolKey, SymbolKey.CreateString(symbol))
InlineHints\InlineHintHelpers.cs (2)
19public static Func<Document, CancellationToken, Task<ImmutableArray<TaggedText>>>? GetDescriptionFunction(int position, SymbolKey symbolKey, SymbolDescriptionOptions options) 22private static async Task<ImmutableArray<TaggedText>> GetDescriptionAsync(Document document, int position, SymbolKey symbolKey, SymbolDescriptionOptions options, CancellationToken cancellationToken)
MetadataAsSource\DecompilationMetadataAsSourceFileProvider.cs (9)
69var symbolId = SymbolKey.Create(symbol, cancellationToken); 384return new UniqueDocumentKey(peMetadataReference.FilePath, peMetadataReference.GetMetadataId(), project.Language, SymbolKey.Create(topLevelNamedType, cancellationToken), signaturesOnly); 389return new UniqueDocumentKey(containingAssembly.Identity, containingAssembly.GetMetadata()?.Id, project.Language, SymbolKey.Create(topLevelNamedType, cancellationToken), signaturesOnly); 395private static readonly IEqualityComparer<SymbolKey> s_symbolIdComparer = SymbolKey.GetComparer(ignoreCase: false, ignoreAssemblyKeys: true); 409private readonly SymbolKey _symbolId; 412public UniqueDocumentKey(string filePath, MetadataId? metadataId, string language, SymbolKey symbolId, bool signaturesOnly) 423public UniqueDocumentKey(AssemblyIdentity assemblyIdentity, MetadataId? metadataId, string language, SymbolKey symbolId, bool signaturesOnly)
MetadataAsSource\MetadataAsSourceFileService.cs (1)
257internal async Task<SymbolMappingResult?> MapSymbolAsync(Document document, SymbolKey symbolId, CancellationToken cancellationToken)
MetadataAsSource\MetadataAsSourceHelpers.cs (1)
70public static async Task<Location> GetLocationInGeneratedSourceAsync(SymbolKey symbolId, Document generatedDocument, CancellationToken cancellationToken)
MetadataAsSource\SymbolMappingServiceFactory.cs (2)
32public Task<SymbolMappingResult?> MapSymbolAsync(Document document, SymbolKey symbolId, CancellationToken cancellationToken) 41=> MapSymbolAsync(document, SymbolKey.Create(symbol, cancellationToken), cancellationToken);
MoveStaticMembers\MoveStaticMembersWithDialogCodeAction.cs (1)
358var symbolKey = member.GetSymbolKey(cancellationToken);
NavigationBar\IRemoteNavigationBarItemService.cs (12)
50public readonly SymbolKey? DestinationTypeSymbolKey; 57public readonly SymbolKey? EventSymbolKey; 62public readonly SymbolKey? MethodToReplicateSymbolKey; 75SymbolKey? destinationTypeSymbolKey, 77SymbolKey? eventSymbolKey, 78SymbolKey? methodToReplicateSymbolKey) 117public static SerializableNavigationBarItem GenerateFinalizer(string text, SymbolKey destinationTypeSymbolKey) 120public static SerializableNavigationBarItem GenerateEventHandler(string eventName, Glyph glyph, string containerName, SymbolKey eventSymbolKey, SymbolKey destinationTypeSymbolKey) 123public static SerializableNavigationBarItem GenerateMethod(string text, Glyph glyph, SymbolKey destinationTypeSymbolId, SymbolKey methodToReplicateSymbolId) 126public static SerializableNavigationBarItem GenerateDefaultConstructor(string text, SymbolKey destinationTypeSymbolKey)
NavigationBar\NavigationBarItems\RoslynNavigationBarItem.AbstractGenerateCodeItem.cs (2)
13public readonly SymbolKey DestinationTypeSymbolKey; 15protected AbstractGenerateCodeItem(RoslynNavigationBarItemKind kind, string text, Glyph glyph, SymbolKey destinationTypeSymbolKey)
NavigationBar\NavigationBarItems\RoslynNavigationBarItem.GenerateDefaultConstructorItem.cs (1)
11public sealed class GenerateDefaultConstructor(string text, SymbolKey destinationTypeSymbolKey) : AbstractGenerateCodeItem(RoslynNavigationBarItemKind.GenerateDefaultConstructor, text, Glyph.MethodPublic, destinationTypeSymbolKey), IEquatable<GenerateDefaultConstructor>
NavigationBar\NavigationBarItems\RoslynNavigationBarItem.GenerateEventHandlerItem.cs (3)
11public sealed class GenerateEventHandler(string text, Glyph glyph, string containerName, SymbolKey eventSymbolKey, SymbolKey destinationTypeSymbolKey) : AbstractGenerateCodeItem(RoslynNavigationBarItemKind.GenerateEventHandler, text, glyph, destinationTypeSymbolKey), IEquatable<GenerateEventHandler> 14public readonly SymbolKey EventSymbolKey = eventSymbolKey;
NavigationBar\NavigationBarItems\RoslynNavigationBarItem.GenerateFinalizerItem.cs (1)
11public sealed class GenerateFinalizer(string text, SymbolKey destinationTypeSymbolKey) : AbstractGenerateCodeItem(RoslynNavigationBarItemKind.GenerateFinalizer, text, Glyph.MethodProtected, destinationTypeSymbolKey), IEquatable<GenerateFinalizer>
NavigationBar\NavigationBarItems\RoslynNavigationBarItem.GenerateMethodItem.cs (3)
11public sealed class GenerateMethod(string text, Glyph glyph, SymbolKey destinationTypeSymbolId, SymbolKey methodToReplicateSymbolId) : AbstractGenerateCodeItem(RoslynNavigationBarItemKind.GenerateMethod, text, glyph, destinationTypeSymbolId), IEquatable<GenerateMethod> 13public readonly SymbolKey MethodToReplicateSymbolKey = methodToReplicateSymbolId;
PdbSourceDocument\PdbSourceDocumentMetadataAsSourceFileProvider.cs (4)
149var key = SymbolKey.Create(symbolToFind, cancellationToken); 253var symbolId = SymbolKey.Create(symbol, cancellationToken);
SignatureHelp\AbstractSignatureHelpProvider.cs (2)
267symbolKeyItem.SymbolKey is not SymbolKey symbolKey || 278symbolKey = SymbolKey.Create(methodSymbol.OriginalDefinition, cancellationToken);
SignatureHelp\AbstractSignatureHelpProvider.SymbolKeySignatureHelpItem.cs (3)
23public SymbolKey? SymbolKey { get; } = symbol?.GetSymbolKey(); 33CodeAnalysis.SymbolKey.GetComparer(ignoreCase: false, ignoreAssemblyKeys: false).Equals(SymbolKey.Value, obj.SymbolKey.Value)); 43var comparer = CodeAnalysis.SymbolKey.GetComparer(ignoreCase: false, ignoreAssemblyKeys: false);
src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (1)
91var constructorInCompilation = (IMethodSymbol?)SymbolKey.Create(constructor).Resolve(semanticModel.Compilation).Symbol;
SymbolMapping\ISymbolMappingService.cs (1)
22Task<SymbolMappingResult?> MapSymbolAsync(Document document, SymbolKey symbolId, CancellationToken cancellationToken = default);
SymbolMapping\SymbolMappingServiceFactory.cs (1)
24public async Task<SymbolMappingResult> MapSymbolAsync(Document document, SymbolKey symbolId, CancellationToken cancellationToken)
ValueTracking\SerializableValueTrackedItem.cs (2)
15SymbolKey symbolKey, 21public SymbolKey SymbolKey { get; } = symbolKey;
ValueTracking\ValueTrackedItem.cs (3)
14public SymbolKey SymbolKey { get; } 23SymbolKey symbolKey, 53SymbolKey.Create(symbol, cancellationToken),
Microsoft.CodeAnalysis.Features.Test.Utilities (6)
EditAndContinue\EditAndContinueTestVerifier.cs (6)
271.GroupBy(e => e.Symbol, SymbolKey.GetComparer(ignoreCase: false, ignoreAssemblyKeys: true)) 316static int CompareEdits(SymbolKey leftKey, SemanticEditKind leftKind, SymbolKey rightKey, SemanticEditKind rightKind) 319SymbolKey CreateSymbolKey(SemanticEditDescription edit) 320=> SymbolKey.Create(edit.SymbolProvider((edit.Kind == SemanticEditKind.Delete) ? oldCompilation : newCompilation)); 336var symbolKey = actualSemanticEdit.Symbol;
Microsoft.CodeAnalysis.Features.UnitTests (90)
FindUsages\DefinitionItemFactoryTests.cs (90)
95var expressionMap = (symbols ?? []).ToDictionary(s => SymbolKey.Create(s.symbol).ToString(), s => $"{nameof(SymbolKey)}.{nameof(SymbolKey.CreateString)}({s.localName})"); 145(tag: "Assembly", text: "Test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", TaggedTextStyle.None, target: SymbolKey.CreateString(a), hint: "Test") 149(tag: "Assembly", text: "Test", TaggedTextStyle.None, target: SymbolKey.CreateString(a), hint: "Test") 181(tag: "Assembly", text: "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", TaggedTextStyle.None, target: SymbolKey.CreateString(m), hint: "mscorlib") 185(tag: "Assembly", text: "mscorlib", TaggedTextStyle.None, target: SymbolKey.CreateString(m), hint: "mscorlib") 198("MetadataSymbolKey", SymbolKey.CreateString(m)), 223(tag: "Module", text: "Test.dll", TaggedTextStyle.None, target: SymbolKey.CreateString(m), hint: "Test.dll") 227(tag: "Module", text: "Test.dll", TaggedTextStyle.None, target: SymbolKey.CreateString(m), hint: "Test.dll") 259(tag: "Module", text: "CommonLanguageRuntimeLibrary", TaggedTextStyle.None, target: SymbolKey.CreateString(m), hint: "CommonLanguageRuntimeLibrary") 263(tag: "Module", text: "CommonLanguageRuntimeLibrary", TaggedTextStyle.None, target: SymbolKey.CreateString(m), hint: "CommonLanguageRuntimeLibrary") 276("MetadataSymbolKey", SymbolKey.CreateString(m)), 367("MetadataSymbolKey", SymbolKey.CreateString(n)), 424("MetadataSymbolKey", SymbolKey.CreateString(n)), 453(tag: "Text", text: "<global namespace>", TaggedTextStyle.None, target: SymbolKey.CreateString(symbol), hint: "") 457(tag: "Text", text: "<global namespace>", TaggedTextStyle.None, target: SymbolKey.CreateString(symbol), hint: "") 493(tag: "Text", text: "<global namespace>", TaggedTextStyle.None, target: SymbolKey.CreateString(symbol), hint: "") 497(tag: "Text", text: "<global namespace>", TaggedTextStyle.None, target: SymbolKey.CreateString(symbol), hint: "") 532(tag: "Class", text: "C", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "C") 536(tag: "Class", text: "C", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "C") 574(tag: "Class", text: "Activator", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "Activator") 578(tag: "Class", text: "Activator", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "Activator") 592("MetadataSymbolKey", SymbolKey.CreateString(c)), 632(tag: "Class", text: "C", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "C") 636(tag: "Class", text: "C", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "C") 650("MetadataSymbolKey", SymbolKey.CreateString(c)), 676(tag: "Keyword", text: "dynamic", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "dynamic") 680(tag: "Keyword", text: "dynamic", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "dynamic") 717(tag: "TypeParameter", text: "T1", TaggedTextStyle.None, target: SymbolKey.CreateString(t1), hint: "T1"), 720(tag: "TypeParameter", text: "T2", TaggedTextStyle.None, target: SymbolKey.CreateString(t2), hint: "T2"), 726(tag: "TypeParameter", text: "T1", TaggedTextStyle.None, target: SymbolKey.CreateString(t1), hint: "T1"), 729(tag: "TypeParameter", text: "T2", TaggedTextStyle.None, target: SymbolKey.CreateString(t2), hint: "T2"), 752("MetadataSymbolKey", SymbolKey.CreateString(genericTuple)), 779(tag: "TypeParameter", text: "T1", TaggedTextStyle.None, target: SymbolKey.CreateString(t1), hint: "T1"), 782(tag: "TypeParameter", text: "T2", TaggedTextStyle.None, target: SymbolKey.CreateString(t2), hint: "T2"), 788(tag: "TypeParameter", text: "T1", TaggedTextStyle.None, target: SymbolKey.CreateString(t1), hint: "T1"), 791(tag: "TypeParameter", text: "T2", TaggedTextStyle.None, target: SymbolKey.CreateString(t2), hint: "T2"), 808("MetadataSymbolKey", SymbolKey.CreateString(genericTuple)), 836(tag: "Class", text: "C", TaggedTextStyle.None, target: SymbolKey.CreateString(genericType), hint: "C<T1, T2>"), 838(tag: "TypeParameter", text: "T1", TaggedTextStyle.None, target: SymbolKey.CreateString(t1), hint: "T1"), 841(tag: "TypeParameter", text: "T2", TaggedTextStyle.None, target: SymbolKey.CreateString(t2), hint: "T2"), 846(tag: "Class", text: "C", TaggedTextStyle.None, target: SymbolKey.CreateString(genericType), hint: "C<T1, T2>") 890(tag: "Class", text: "Dictionary", TaggedTextStyle.None, target: SymbolKey.CreateString(genericType), hint: "Dictionary<TKey, TValue>"), 892(tag: "TypeParameter", text: "TKey", TaggedTextStyle.None, target: SymbolKey.CreateString(t1), hint: "TKey"), 895(tag: "TypeParameter", text: "TValue", TaggedTextStyle.None, target: SymbolKey.CreateString(t2), hint: "TValue"), 900(tag: "Class", text: "Dictionary", TaggedTextStyle.None, target: SymbolKey.CreateString(genericType), hint: "Dictionary<TKey, TValue>") 914("MetadataSymbolKey", SymbolKey.CreateString(genericType)), 948(tag: "TypeParameter", text: "T", TaggedTextStyle.None, target: SymbolKey.CreateString(p), hint: "T") 952(tag: "TypeParameter", text: "T", TaggedTextStyle.None, target: SymbolKey.CreateString(p), hint: "T") 994(tag: "Class", text: "C", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "C"), 996(tag: "Method", text: "M", TaggedTextStyle.None, target: SymbolKey.CreateString(m), hint: "void C.M(int x)"), 998(tag: "Keyword", text: "int", TaggedTextStyle.None, target: SymbolKey.CreateString(i), hint: "int"), 1003(tag: "Class", text: "C", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "C"), 1005(tag: "Method", text: "M", TaggedTextStyle.None, target: SymbolKey.CreateString(m), hint: "void C.M(int x)") 1047(tag: "Keyword", text: "int", TaggedTextStyle.None, target: SymbolKey.CreateString(i), hint: "int"), 1049(tag: "Class", text: "C", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "C"), 1051(tag: "Field", text: "M", TaggedTextStyle.None, target: SymbolKey.CreateString(m), hint: "int C.M") 1055(tag: "Class", text: "C", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "C"), 1057(tag: "Field", text: "M", TaggedTextStyle.None, target: SymbolKey.CreateString(m), hint: "int C.M") 1099(tag: "Keyword", text: "int", TaggedTextStyle.None, target: SymbolKey.CreateString(i), hint: "int"), 1101(tag: "Class", text: "C", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "C"), 1103(tag: "Property", text: "P", TaggedTextStyle.None, target: SymbolKey.CreateString(p), hint: "int C.P"), 1117(tag: "Class", text: "C", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "C"), 1119(tag: "Property", text: "P", TaggedTextStyle.None, target: SymbolKey.CreateString(p), hint: "int C.P") 1163(tag: "Keyword", text: "int", TaggedTextStyle.None, target: SymbolKey.CreateString(i), hint: "int"), 1165(tag: "Class", text: "C", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "C"), 1167(tag: "Property", text: "P", TaggedTextStyle.None, target: SymbolKey.CreateString(p), hint: "int C.P"), 1173(tag: "Class", text: "C", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "C"), 1175(tag: "Property", text: "P", TaggedTextStyle.None, target: SymbolKey.CreateString(p), hint: "int C.P"), 1222(tag: "Class", text: "C", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "C"), 1224(tag: "Property", text: "P", TaggedTextStyle.None, target: SymbolKey.CreateString(p), hint: "int C.P"), 1230(tag: "Class", text: "C", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "C"), 1232(tag: "Property", text: "P", TaggedTextStyle.None, target: SymbolKey.CreateString(p), hint: "int C.P"), 1277(tag: "Keyword", text: "int", TaggedTextStyle.None, target: SymbolKey.CreateString(i), hint: "int"), 1279(tag: "Class", text: "C", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "C"), 1283(tag: "Keyword", text: "int", TaggedTextStyle.None, target: SymbolKey.CreateString(i), hint: "int"), 1298(tag: "Class", text: "C", TaggedTextStyle.None, target: SymbolKey.CreateString(c), hint: "C"), 1355(tag: "Keyword", text: "int", TaggedTextStyle.None, target: SymbolKey.CreateString(i), hint: "int"), 1357(tag: "Parameter", text: "p", TaggedTextStyle.None, target: SymbolKey.CreateString(p), hint: "int p") 1361(tag: "Parameter", text: "p", TaggedTextStyle.None, target: SymbolKey.CreateString(p), hint: "int p") 1414(tag: "TypeParameter", text: "T", TaggedTextStyle.None, target: SymbolKey.CreateString(p), hint: "T") 1418(tag: "TypeParameter", text: "T", TaggedTextStyle.None, target: SymbolKey.CreateString(p), hint: "T") 1468(tag: "Method", text: "F", TaggedTextStyle.None, target: SymbolKey.CreateString(f), hint: "void F()"), 1474(tag: "Method", text: "F", TaggedTextStyle.None, target: SymbolKey.CreateString(f), hint: "void F()") 1533(tag: "Keyword", text: "int", TaggedTextStyle.None, target: SymbolKey.CreateString(i), hint: "int"), 1535(tag: "Local", text: "x", TaggedTextStyle.None, target: SymbolKey.CreateString(x), hint: "int x") 1539(tag: "Local", text: "x", TaggedTextStyle.None, target: SymbolKey.CreateString(x), hint: "int x") 1606(tag: "RangeVariable", text: "x", TaggedTextStyle.None, target: SymbolKey.CreateString(r), hint: "? x") 1610(tag: "RangeVariable", text: "x", TaggedTextStyle.None, target: SymbolKey.CreateString(r), hint: "? x")
Microsoft.CodeAnalysis.Remote.ServiceHub (3)
Services\EncapsulateField\RemoteEncapsulateFieldService.cs (1)
41if (SymbolKey.ResolveString(key, compilation, cancellationToken: cancellationToken).GetAnySymbol() is not IFieldSymbol resolved)
Services\ExtensionMethodImportCompletion\RemoteExtensionMethodImportCompletionService.cs (2)
43var symbol = SymbolKey.ResolveString(receiverTypeSymbolKeyData, compilation, cancellationToken: cancellationToken).GetAnySymbol(); 50.Select(symbolKey => SymbolKey.ResolveString(symbolKey, compilation, cancellationToken: cancellationToken).GetAnySymbol() as ITypeSymbol)
Microsoft.CodeAnalysis.Workspaces (37)
ExternalAccess\UnitTesting\Api\UnitTestingSymbolExtensions.cs (1)
12=> SymbolKey.Create(symbol, cancellationToken).ToString();
FindSymbols\SymbolFinder.cs (1)
163var key = symbol.GetSymbolKey(cancellationToken);
FindSymbols\SymbolFinder_FindReferences_Current.cs (1)
42if (!SymbolKey.IsBodyLevelSymbol(symbol) && SerializableSymbolAndProjectId.TryCreate(symbol, solution, cancellationToken, out var serializedSymbol))
Remote\RemoteArguments.cs (3)
89if (!SymbolKey.CanCreate(symbol, cancellationToken)) 95result = new SerializableSymbolAndProjectId(SymbolKey.CreateString(symbol, cancellationToken), project.Id); 108var symbol = SymbolKey.ResolveString(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (2)
243if (!SymbolKey.Equals(reader.Compilation, name, symbol.Name)) 266SymbolKey.Equals(semanticModel.Compilation, symbol.Name, localName))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (15)
21/// A <see cref="SymbolKey"/> is a lightweight identifier for a symbol that can be used to 100/// <see cref="SymbolKey"/>s are not guaranteed to work across different versions of Roslyn. They can be persisted 106/// The string values produced by <see cref="CreateString"/> (or <see cref="SymbolKey.ToString"/>) should not be 108/// 'same' symbol might produce different strings. Instead, to compare keys use <see cref="SymbolKey.GetComparer"/> 113internal partial struct SymbolKey(string data) : IEquatable<SymbolKey> 127/// Constructs a new <see cref="SymbolKey"/> representing the provided <paramref name="symbol"/>. 129public static SymbolKey Create(ISymbol? symbol, CancellationToken cancellationToken = default) 133/// Returns an <see cref="IEqualityComparer{T}"/> that determines if two <see cref="SymbolKey"/>s 145public static IEqualityComparer<SymbolKey> GetComparer(bool ignoreCase = false, bool ignoreAssemblyKeys = false) 189failureReason = $"({nameof(SymbolKey)} invalid format '${version}')"; 221/// Tries to resolve this <see cref="SymbolKey"/> in the given 231/// Returns this <see cref="SymbolKey"/> encoded as a string. This can be persisted 354=> obj is SymbolKey symbolKey && this.Equals(symbolKey); 356public readonly bool Equals(SymbolKey other) 359private readonly bool Equals(SymbolKey other, bool ignoreCase)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ParameterSymbolKey.cs (1)
91if (SymbolKey.Equals(reader.Compilation, parameter.MetadataName, metadataName))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyComparer.cs (6)
12private sealed class SymbolKeyComparer : IEqualityComparer<SymbolKey> 19public bool Equals(SymbolKey x, SymbolKey y) 49public int GetHashCode(SymbolKey obj) 52public static IEqualityComparer<SymbolKey> GetComparer(bool ignoreCase, bool ignoreAssemblyKey) 63public static IEqualityComparer<SymbolKey> GetComparer(ComparisonOptions options)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKeyExtensions.cs (2)
11public static SymbolKey GetSymbolKey(this ISymbol? symbol, CancellationToken cancellationToken = default) 12=> SymbolKey.Create(symbol, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKeyResolution.cs (2)
10/// The result of <see cref="SymbolKey.Resolve"/>. If the <see cref="SymbolKey"/> could be uniquely mapped to a
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SymbolFinder\SymbolFinderInternal.cs (1)
82var symbolId = symbol.GetSymbolKey(cancellationToken);
Workspace\Solution\SolutionCompilationState.RootedSymbolSet.cs (1)
49/// cref="SymbolKey"/>) to resolve that symbol back in that that <see cref="Project"/>.
Workspace\Solution\SolutionCompilationState.SymbolToProjectId.cs (1)
70if (SymbolKey.IsBodyLevelSymbol(symbol))
Microsoft.CodeAnalysis.Workspaces.UnitTests (42)
SymbolKeyTests.cs (42)
67TestVersion(symbol, compilation, SymbolKey.FormatVersion - 1); 68TestVersion(symbol, compilation, SymbolKey.FormatVersion + 1); 74var id = SymbolKey.CreateStringWorker(version, symbol); 76var found = SymbolKey.ResolveString(id, compilation).GetAnySymbol(); 406var key = SymbolKey.CreateString(b); 407var resolved = SymbolKey.ResolveString(key, compilation2).Symbol; 430var key = SymbolKey.CreateString(b); 431var resolved = SymbolKey.ResolveString(key, compilation2).Symbol; 874Assert.NotEqual(default, SymbolKey.Create(xSymbol)); 921Assert.NotEqual(default, SymbolKey.Create(xSymbol)); 946var key = SymbolKey.Create(method); 977var id = SymbolKey.CreateString(symbol); 979var found = SymbolKey.ResolveString(id, compilation).GetAnySymbol(); 1016var id = SymbolKey.CreateString(symbol); 1021var found = SymbolKey.ResolveString(id, compilation2).GetAnySymbol(); 1054var id = SymbolKey.CreateString(symbol); 1059var found = SymbolKey.ResolveString(id, compilation2).GetAnySymbol(); 1091var id = SymbolKey.CreateString(propType); 1096var found = SymbolKey.ResolveString(id, compilation2).GetAnySymbol(); 1127var id = SymbolKey.CreateString(propType); 1132var found = SymbolKey.ResolveString(id, compilation2).GetAnySymbol(); 1178var id = SymbolKey.CreateString(propType); 1183var found = SymbolKey.ResolveString(id, compilation2).GetAnySymbol(); 1227var id = SymbolKey.CreateString(propType); 1232var found = SymbolKey.ResolveString(id, compilation2).GetAnySymbol(); 1281var id = SymbolKey.CreateString(symbol); 1286var found = SymbolKey.ResolveString(id, compilation1).GetAnySymbol(); 1295var id = SymbolKey.CreateString(symbol.OriginalDefinition); 1298var found = SymbolKey.ResolveString(id, compilation1).GetAnySymbol(); 1312var symbolKey1 = SymbolKey.Create(compilation1.GetSpecialType(SpecialType.System_Int32)); 1313var symbolKey2 = SymbolKey.Create(compilation2.GetSpecialType(SpecialType.System_Int32)); 1318Assert.True(SymbolKey.GetComparer(ignoreCase: true).Equals(symbolKey1, symbolKey2)); 1319Assert.True(SymbolKey.GetComparer(ignoreAssemblyKeys: true).Equals(symbolKey1, symbolKey2)); 1320Assert.True(SymbolKey.GetComparer(ignoreCase: true, ignoreAssemblyKeys: true).Equals(symbolKey1, symbolKey2)); 1403var symbols = methods.SelectMany(ms => GetInteriorSymbols(ms, compilation)).Where(s => SymbolKey.IsBodyLevelSymbol(s)).ToList(); 1423var key = SymbolKey.Create(symbol); 1446var id = SymbolKey.CreateString(symbol); 1448var found = SymbolKey.ResolveString(id, compilation).GetAnySymbol();
Microsoft.VisualStudio.LanguageServices (3)
CallHierarchy\Finders\AbstractCallFinder.cs (1)
25private readonly SymbolKey _symbolKey;
Library\ObjectBrowser\Lists\SymbolListItem.cs (1)
15private readonly SymbolKey _symbolKey;
Snippets\SnippetExpansionClient.cs (1)
746var newSymbolKey = (newModel.SelectedItem as AbstractSignatureHelpProvider.SymbolKeySignatureHelpItem)?.SymbolKey ?? default;