From c176b5953f68e53e88eb9aa1e5906dbcb94cdac5 Mon Sep 17 00:00:00 2001 From: Jon Sequeira Date: Tue, 7 Mar 2017 07:10:12 -0800 Subject: [PATCH] additional logging --- src/dotnet/ForwardingApp.cs | 2 + .../dotnet-complete/CompleteCommand.cs | 48 +++++++++++-------- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/dotnet/ForwardingApp.cs b/src/dotnet/ForwardingApp.cs index 2ae292b75..01f26aa46 100644 --- a/src/dotnet/ForwardingApp.cs +++ b/src/dotnet/ForwardingApp.cs @@ -80,6 +80,8 @@ namespace Microsoft.DotNet.Cli UseShellExecute = false }; + Reporter.Verbose.WriteLine($"[Forwarding] {processInfo.FileName} {processInfo.Arguments}"); + if (_environmentVariables != null) { foreach (var entry in _environmentVariables) diff --git a/src/dotnet/commands/dotnet-complete/CompleteCommand.cs b/src/dotnet/commands/dotnet-complete/CompleteCommand.cs index f8b08125e..8cb88994b 100644 --- a/src/dotnet/commands/dotnet-complete/CompleteCommand.cs +++ b/src/dotnet/commands/dotnet-complete/CompleteCommand.cs @@ -14,28 +14,34 @@ namespace Microsoft.DotNet.Cli { public static int Run(string[] args) { - DebugHelper.HandleDebugSwitch(ref args); - - // get the parser for the current subcommand - var completeCommandParser = Parser.DotnetCommand["complete"]; - - // parse the arguments - var result = completeCommandParser.Parse(args); - - var complete = result["complete"]; - - var suggestions = Suggestions(complete); - -#if DEBUG - var log = new StringBuilder(); - log.AppendLine($"args: {string.Join(" ", args.Select(a => $"\"{a}\""))}"); - log.AppendLine("diagram: " + result.Diagram()); - File.WriteAllText("parse.log", log.ToString()); -#endif - - foreach (var suggestion in suggestions) + try { - Console.WriteLine(suggestion); + DebugHelper.HandleDebugSwitch(ref args); + + // get the parser for the current subcommand + var parser = Parser.DotnetCommand["complete"]; + + // parse the arguments + var result = parser.Parse(args); + + var complete = result["complete"]; + + var suggestions = Suggestions(complete); + + var log = new StringBuilder(); + log.AppendLine($"args: {string.Join(" ", args.Select(a => $"\"{a}\""))}"); + log.AppendLine("diagram: " + result.Diagram()); + File.WriteAllText("parse.log", log.ToString()); + + foreach (var suggestion in suggestions) + { + Console.WriteLine(suggestion); + } + } + catch (Exception e) + { + File.WriteAllText("dotnet completion exception.log", e.ToString()); + throw; } return 0;