public async Task TestSymbolTreeInfoSerialization() { var solution = GetSolution(WorkspaceKind.SingleClass); var project = solution.Projects.First(); // create symbol tree info from assembly var info = await SymbolTreeInfo.CreateSourceSymbolTreeInfoAsync( project, Checksum.Null, cancellationToken : CancellationToken.None); using (var writerStream = new MemoryStream()) { using (var writer = new ObjectWriter(writerStream)) { info.WriteTo(writer); } using (var readerStream = new MemoryStream(writerStream.ToArray())) using (var reader = ObjectReader.TryGetReader(readerStream)) { var readInfo = SymbolTreeInfo.ReadSymbolTreeInfo_ForTestingPurposesOnly( reader, Checksum.Null); info.AssertEquivalentTo(readInfo); } } }
public async Task TestSymbolTreeInfoSerialization() { var solution = GetSolution(WorkspaceKind.SingleClass); var compilation = await solution.Projects.First().GetCompilationAsync(); var assembly = compilation.GetSpecialType(SpecialType.System_Byte).ContainingAssembly; ////var assembly = compilation.Assembly; // create symbol tree info from assembly var version = VersionStamp.Create(); var info = SymbolTreeInfo.CreateSourceSymbolTreeInfo( solution, version, assembly, "", cancellationToken: CancellationToken.None); using (var writerStream = new MemoryStream()) { using (var writer = new ObjectWriter(writerStream)) { info.WriteTo(writer); } using (var readerStream = new MemoryStream(writerStream.ToArray())) using (var reader = new ObjectReader(readerStream)) { var readInfo = SymbolTreeInfo.ReadSymbolTreeInfo_ForTestingPurposesOnly(reader); info.AssertEquivalentTo(readInfo); } } }