提交 6ff0dbe3 编写于 作者: H Heejae Chang

get ParseOptions from ProjectState rather than calculate one itself

上级 94ca919c
......@@ -74,6 +74,7 @@ private static Type[] GetNeutralAndCSharpAndVisualBasicTypes()
typeof(VisualBasic.LanguageServices.VisualBasicContentTypeLanguageService),
typeof(CodeAnalysis.CSharp.Execution.CSharpOptionsSerializationService),
typeof(CodeAnalysis.VisualBasic.Execution.VisualBasicOptionsSerializationService),
typeof(CodeAnalysis.Execution.DesktopReferenceSerializationServiceFactory),
typeof(TestExportProvider)
};
......
......@@ -19,7 +19,7 @@ namespace Microsoft.CodeAnalysis.Execution
/// this is desktop implementation of IReferenceSerializationService
/// </summary>
[ExportWorkspaceServiceFactory(typeof(IReferenceSerializationService), layer: ServiceLayer.Desktop), Shared]
internal class ReferenceSerializationServiceFactory : IWorkspaceServiceFactory
internal class DesktopReferenceSerializationServiceFactory : IWorkspaceServiceFactory
{
private static readonly SerializationAnalyzerAssemblyLoader s_loader = new SerializationAnalyzerAssemblyLoader();
......
......@@ -80,15 +80,12 @@ private void WriteFormatAndChecksum(ObjectWriter writer, string formatVersion)
// any time the SyntaxTree could have changed. Right now, that can only happen if the
// text of the document changes, or the ParseOptions change. So we get the checksums
// for both of those, and merge them together to make the final checksum.
var projectChecksumState = await document.Project.State.GetStateChecksumsAsync(cancellationToken).ConfigureAwait(false);
var parseOptionsChecksum = projectChecksumState.ParseOptions;
var documentChecksumState = await document.State.GetStateChecksumsAsync(cancellationToken).ConfigureAwait(false);
var textChecksum = documentChecksumState.Text;
var parseOptions = document.Project.ParseOptions;
var serializer = new Serializer(document.Project.Solution.Workspace);
var parseOptionsChecksum = ChecksumCache.GetOrCreate(
parseOptions, _ => serializer.CreateChecksum(parseOptions, cancellationToken));
return Checksum.Create(WellKnownSynchronizationKind.SyntaxTreeIndex, new[] { textChecksum, parseOptionsChecksum });
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册