public T Deserialize <T>(WellKnownSynchronizationKind kind, ObjectReader reader, CancellationToken cancellationToken) { using (Logger.LogBlock(FunctionId.Serializer_Deserialize, kind.ToString(), cancellationToken)) { cancellationToken.ThrowIfCancellationRequested(); switch (kind) { case WellKnownSynchronizationKind.Null: return(default); case WellKnownSynchronizationKind.SolutionState: case WellKnownSynchronizationKind.ProjectState: case WellKnownSynchronizationKind.DocumentState: case WellKnownSynchronizationKind.Projects: case WellKnownSynchronizationKind.Documents: case WellKnownSynchronizationKind.TextDocuments: case WellKnownSynchronizationKind.ProjectReferences: case WellKnownSynchronizationKind.MetadataReferences: case WellKnownSynchronizationKind.AnalyzerReferences: return((T)(object)DeserializeChecksumWithChildren(reader, cancellationToken)); case WellKnownSynchronizationKind.SolutionAttributes: return((T)(object)SolutionInfo.SolutionAttributes.ReadFrom(reader)); case WellKnownSynchronizationKind.ProjectAttributes: return((T)(object)ProjectInfo.ProjectAttributes.ReadFrom(reader)); case WellKnownSynchronizationKind.DocumentAttributes: return((T)(object)DocumentInfo.DocumentAttributes.ReadFrom(reader)); case WellKnownSynchronizationKind.CompilationOptions: return((T)(object)DeserializeCompilationOptions(reader, cancellationToken)); case WellKnownSynchronizationKind.ParseOptions: return((T)(object)DeserializeParseOptions(reader, cancellationToken)); case WellKnownSynchronizationKind.ProjectReference: return((T)(object)DeserializeProjectReference(reader, cancellationToken)); case WellKnownSynchronizationKind.MetadataReference: return((T)(object)DeserializeMetadataReference(reader, cancellationToken)); case WellKnownSynchronizationKind.AnalyzerReference: return((T)(object)DeserializeAnalyzerReference(reader, cancellationToken)); case WellKnownSynchronizationKind.SourceText: return((T)(object)DeserializeSourceText(reader, cancellationToken)); case WellKnownSynchronizationKind.OptionSet: return((T)(object)DeserializeOptionSet(reader, cancellationToken)); default: throw ExceptionUtilities.UnexpectedValue(kind); } } }