From c38d9dac5900d7caaa28de6a1fdbacba85c50f96 Mon Sep 17 00:00:00 2001 From: Sung Yoon Whang Date: Fri, 13 Sep 2019 22:12:26 -0700 Subject: [PATCH] Show warning when providers are specified via GUID (#476) * Show warning when providers are specified via GUID * Lets not throw useless exceptions * Fix typo --- src/Tools/dotnet-trace/Extensions.cs | 7 +++++++ src/Tools/dotnet-trace/trace.speedscope.json | 1 + 2 files changed, 8 insertions(+) create mode 100644 src/Tools/dotnet-trace/trace.speedscope.json diff --git a/src/Tools/dotnet-trace/Extensions.cs b/src/Tools/dotnet-trace/Extensions.cs index 0967d6da9..fbaf43847 100644 --- a/src/Tools/dotnet-trace/Extensions.cs +++ b/src/Tools/dotnet-trace/Extensions.cs @@ -29,6 +29,13 @@ namespace Microsoft.Diagnostics.Tools.Trace // Provider name string providerName = tokens.Length > 0 ? tokens[0] : null; + + // Check if the supplied provider is a GUID and not a name. + if (Guid.TryParse(providerName, out _)) + { + Console.WriteLine($"Warning: --provider argument {providerName} appears to be a GUID which is not supported by dotnet-trace. Providers need to be referenced by their textual name."); + } + if (string.IsNullOrWhiteSpace(providerName)) throw new ArgumentException("Provider name was not specified."); diff --git a/src/Tools/dotnet-trace/trace.speedscope.json b/src/Tools/dotnet-trace/trace.speedscope.json new file mode 100644 index 000000000..26967caf5 --- /dev/null +++ b/src/Tools/dotnet-trace/trace.speedscope.json @@ -0,0 +1 @@ +{"exporter": "speedscope@1.3.2", "name": "trace.speedscope", "activeProfileIndex": 0, "$schema": "https://www.speedscope.app/file-format-schema.json", "shared": { "frames": [ { "name": "Process64 Process(60720) (60720) Args: " }, { "name": "(Non-Activities)" }, { "name": "Threads" }, { "name": "Thread (3408949)" }, { "name": "hamham!my_own_counter.Program.Main(class System.String[])" }, { "name": "System.Private.CoreLib!System.Threading.Thread.Sleep(int32)" }, { "name": "UNMANAGED_CODE_TIME" }] }, "profiles": [ { "type": "evented", "name": "Thread (3408949)", "unit": "milliseconds", "startValue": "0.994686", "endValue": "3038.3867300143816", "events": [ { "type": "O", "frame": 0, "at": 0.994686 }, { "type": "O", "frame": 1, "at": 0.994686 }, { "type": "O", "frame": 2, "at": 0.994686 }, { "type": "O", "frame": 3, "at": 0.994686 }, { "type": "O", "frame": 4, "at": 0.994686 }, { "type": "O", "frame": 5, "at": 0.994686 }, { "type": "O", "frame": 6, "at": 0.994686 }, { "type": "C", "frame": 6, "at": 864.61229 }, { "type": "C", "frame": 5, "at": 864.61229 }, { "type": "O", "frame": 6, "at": 864.61229 }, { "type": "C", "frame": 6, "at": 865.79786095527652 }, { "type": "O", "frame": 5, "at": 865.797861 }, { "type": "O", "frame": 6, "at": 865.797861 }, { "type": "C", "frame": 6, "at": 3038.3867300143816 }, { "type": "C", "frame": 5, "at": 3038.3867300143816 }, { "type": "C", "frame": 4, "at": 3038.3867300143816 }, { "type": "C", "frame": 3, "at": 3038.3867300143816 }, { "type": "C", "frame": 2, "at": 3038.3867300143816 }, { "type": "C", "frame": 1, "at": 3038.3867300143816 }, { "type": "C", "frame": 0, "at": 3038.3867300143816 }]}] } \ No newline at end of file -- 2.34.1