From: Sung Yoon Whang Date: Sun, 30 Jun 2019 04:51:05 +0000 (-0700) Subject: Avoid unnecessary allocation & better error message on file exists error (#371) X-Git-Tag: submit/tizen/20190813.035844~4^2^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3e613e8c4507a86e177ef27b288d0701d6d1e340;p=platform%2Fcore%2Fdotnet%2Fdiagnostics.git Avoid unnecessary allocation & better error message on file exists error (#371) --- diff --git a/src/Tools/dotnet-trace/CommandLine/Commands/CollectCommand.cs b/src/Tools/dotnet-trace/CommandLine/Commands/CollectCommand.cs index dbd329d7e..13d4d286c 100644 --- a/src/Tools/dotnet-trace/CommandLine/Commands/CollectCommand.cs +++ b/src/Tools/dotnet-trace/CommandLine/Commands/CollectCommand.cs @@ -113,7 +113,7 @@ namespace Microsoft.Diagnostics.Tools.Trace } if (File.Exists(output.FullName)) { - Console.Error.WriteLine("Unable to create file."); + Console.Error.WriteLine($"Unable to create file {output.FullName}. Try using -o or --output option to specify a different output file name."); return ErrorCodes.FileCreationError; } var collectingTask = new Task(() => { @@ -125,10 +125,10 @@ namespace Microsoft.Diagnostics.Tools.Trace Console.Out.WriteLine($"Output File : {fs.Name}"); Console.Out.WriteLine($"\tSession Id: 0x{sessionId:X16}"); lineToClear = Console.CursorTop; + var buffer = new byte[16 * 1024]; while (true) { - var buffer = new byte[16 * 1024]; int nBytesRead = stream.Read(buffer, 0, buffer.Length); if (nBytesRead <= 0) break;