From 3aec3cb5c4fc44ab03df561ebf5186f02c7bba1d Mon Sep 17 00:00:00 2001 From: Praveen Kuttappan Date: Tue, 16 Jul 2024 07:26:37 -0400 Subject: [PATCH] Add await and change to asynchronous serialization --- .../parsers/csharp-api-parser/CSharpAPIParser/Program.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/Program.cs b/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/Program.cs index a2250a14189..7915231c8cd 100644 --- a/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/Program.cs +++ b/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/Program.cs @@ -125,8 +125,7 @@ static async Task HandlePackageFileParsing(Stream stream, FileInfo packageFilePa await using FileStream gzipFileStream = new FileStream(gzipJsonTokenFilePath, FileMode.Create, FileAccess.Write); await using GZipStream gZipStream = new GZipStream(gzipFileStream, CompressionLevel.Optimal); - JsonSerializer.Serialize(new Utf8JsonWriter(gZipStream, new JsonWriterOptions { Indented = false }), treeTokenCodeFile, options); - await Task.Delay(1000); + await JsonSerializer.SerializeAsync(gZipStream, treeTokenCodeFile, options); Console.WriteLine($"TokenCodeFile File {gzipJsonTokenFilePath} Generated Successfully."); Console.WriteLine(); }