提交 3dd419ef 编写于 作者: M Manish Vasani

Fix serialization/deserialization of SymbolUsageInfo in SerializableSourceReferenceItem

Fixes #44184
Find References "Kind" column uses `SymbolUsageInfo` for its data. `SymbolUsageInfo` is correctly serialized/deserialized when Find References is invoked via [SymbolFinder.FindReferencesServerCallback](https://github.com/dotnet/roslyn/blob/b8585be8e9ff9e30dbe64980e2c9156ae8b6c2bf/src/Workspaces/Core/Portable/FindSymbols/SymbolFinder.FindReferencesServerCallback.cs#L72-L84), as it uses [SerializableReferenceLocation](https://github.com/dotnet/roslyn/blob/a65653a77b2862329052d84816b5fb324f8bc8bd/src/Workspaces/Core/Portable/Remote/RemoteArguments.cs#L156) which uses `SerializableSymbolUsageInfo`. With https://github.com/dotnet/roslyn/pull/43914/, we added a new [FindUsagesServerCallback](https://github.com/dotnet/roslyn/blob/0852232f315e952fee1dc63a0b374614b55c1c69/src/EditorFeatures/Core/FindUsages/IRemoteFindUsagesService.cs#L32) and switched to it for Find references serialization/deserialization. This callback does not use `SerializableSymbolUsageInfo`, hence loses the SymbolUsageInfo for "Kind" column. This change fixes this part.
上级 5bd1f86c
...@@ -163,7 +163,7 @@ internal class SerializableSourceReferenceItem ...@@ -163,7 +163,7 @@ internal class SerializableSourceReferenceItem
{ {
public int DefinitionId; public int DefinitionId;
public SerializableDocumentSpan SourceSpan; public SerializableDocumentSpan SourceSpan;
public SymbolUsageInfo SymbolUsageInfo; public SerializableSymbolUsageInfo SymbolUsageInfo;
public (string Key, string Value)[] AdditionalProperties; public (string Key, string Value)[] AdditionalProperties;
public static SerializableSourceReferenceItem Dehydrate( public static SerializableSourceReferenceItem Dehydrate(
...@@ -173,7 +173,7 @@ internal class SerializableSourceReferenceItem ...@@ -173,7 +173,7 @@ internal class SerializableSourceReferenceItem
{ {
DefinitionId = definitionId, DefinitionId = definitionId,
SourceSpan = SerializableDocumentSpan.Dehydrate(item.SourceSpan), SourceSpan = SerializableDocumentSpan.Dehydrate(item.SourceSpan),
SymbolUsageInfo = item.SymbolUsageInfo, SymbolUsageInfo = SerializableSymbolUsageInfo.Dehydrate(item.SymbolUsageInfo),
AdditionalProperties = item.AdditionalProperties.Select(kvp => (kvp.Key, kvp.Value)).ToArray(), AdditionalProperties = item.AdditionalProperties.Select(kvp => (kvp.Key, kvp.Value)).ToArray(),
}; };
} }
...@@ -183,7 +183,7 @@ public SourceReferenceItem Rehydrate(Solution solution, DefinitionItem definitio ...@@ -183,7 +183,7 @@ public SourceReferenceItem Rehydrate(Solution solution, DefinitionItem definitio
return new SourceReferenceItem( return new SourceReferenceItem(
definition, definition,
SourceSpan.Rehydrate(solution), SourceSpan.Rehydrate(solution),
SymbolUsageInfo, SymbolUsageInfo.Rehydrate(),
AdditionalProperties.ToImmutableDictionary(t => t.Key, t => t.Value)); AdditionalProperties.ToImmutableDictionary(t => t.Key, t => t.Value));
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册