diff --git a/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/CSharpAPIParser.csproj b/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/CSharpAPIParser.csproj
index 2fa0ca2222c..d4936c4de62 100644
--- a/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/CSharpAPIParser.csproj
+++ b/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/CSharpAPIParser.csproj
@@ -4,7 +4,7 @@
Exe
true
CSharpAPIParserForAPIView
- net7.0
+ net8.0
CSharpAPIParser
enable
enable
diff --git a/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/Program.cs b/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/Program.cs
index 5c4d9f58de6..7915231c8cd 100644
--- a/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/Program.cs
+++ b/tools/apiview/parsers/csharp-api-parser/CSharpAPIParser/Program.cs
@@ -123,12 +123,9 @@ static async Task HandlePackageFileParsing(Stream stream, FileInfo packageFilePa
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
};
- {
- using FileStream gzipFileStream = new FileStream(gzipJsonTokenFilePath, FileMode.Create, FileAccess.Write);
- using GZipStream gZipStream = new GZipStream(gzipFileStream, CompressionLevel.Optimal);
- JsonSerializer.Serialize(new Utf8JsonWriter(gZipStream, new JsonWriterOptions { Indented = false }), treeTokenCodeFile, options);
- }
-
+ await using FileStream gzipFileStream = new FileStream(gzipJsonTokenFilePath, FileMode.Create, FileAccess.Write);
+ await using GZipStream gZipStream = new GZipStream(gzipFileStream, CompressionLevel.Optimal);
+ await JsonSerializer.SerializeAsync(gZipStream, treeTokenCodeFile, options);
Console.WriteLine($"TokenCodeFile File {gzipJsonTokenFilePath} Generated Successfully.");
Console.WriteLine();
}