Skip to content

The command hasn't been executed: accepted; Profiler attach failed (HRESULT: 0x80004005). #9

@OlegJakushkin

Description

@OlegJakushkin

So I have a simple code

   public static class DotTraceAssist
    {
        public static volatile bool Started;
        public static volatile bool Happened;
        public static DotTrace.Config Config;

        public static void Check(Func<bool> pred)
        {
            if (pred())
            {
                Happened = true;
            }
            if (!Started)
            {
                Started = true;
                string? dir = Directory.GetCurrentDirectory();

                Trace.Source.Switch = new SourceSwitch("SourceSwitch", "Verbose");
                Trace.Source.Listeners.Add(new ConsoleTraceListener());
                DotTrace.EnsurePrerequisite(downloadTo: "C:\\Users\\Administrator\\AppData\\Local\\JetBrains\\Profiler");

                var cfg = new DotTrace.Config();
                cfg.UseTimelineProfilingType(true);

                dir = Path.Combine(dir, "timelines");
                if (!Directory.Exists(dir))
                    Directory.CreateDirectory(dir);
                cfg.SaveToDir(dir);

                Config = cfg;
                var act = () =>
                {
                    DotTrace.Attach(Config);
                    while (Started)
                    {
                        DotTrace.StartCollectingData();

                        Thread.Sleep(20000);
                        if (Happened)
                        {
                            Thread.Sleep(20000);
                            Happened = false;
                            DotTrace.SaveData();
                        }
                        else
                        {
                            DotTrace.DropData();
                            DotTrace.StartCollectingData();
                        }
                    }
                };
                ThreadPool.QueueUserWorkItem(o => { act(); });
            }

        }
    }

And contents of latest .zip extracted into C:\Users\Administrator\AppData\Local\JetBrains\Profiler

And my log is:

JetBrains.Profiler.SelfApi Verbose: 1 : Prerequisite.TryGetRunner: `dottrace.exe`
JetBrains.Profiler.SelfApi Verbose: 2 : Prerequisite.TryGetRunner: External path provided, looking at `C:\Users\Administrator\AppData\Local\JetBrains\Profiler\dottrace.exe`
JetBrains.Profiler.SelfApi Verbose: 3 : Prerequisite[dotTrace].DownloadAsync: Runner found, no async task needed.
...
JetBrains.Profiler.SelfApi Verbose: 4 : DotTrace.RunConsole: Looking for runner...
JetBrains.Profiler.SelfApi Verbose: 5 : Prerequisite.TryGetRunner: `dottrace.exe`
JetBrains.Profiler.SelfApi Verbose: 6 : Prerequisite.TryGetRunner: External path provided, looking at `C:\Users\Administrator\AppData\Local\JetBrains\Profiler\dottrace.exe`
JetBrains.Profiler.SelfApi Information: 7 : DotTrace.RunConsole:
  runner = `C:\Users\Administrator\AppData\Local\JetBrains\Profiler\dottrace.exe`
  arguments = `attach 8676 --profiling-type=Timeline --service-input=stdin --service-output=On --collect-data-from-start=Off --use-api "--save-to=C:\work\n44\nethermind\src\Nethermind\Nethermind.Runner\timelines" --ask-uac-elevation`
JetBrains.Profiler.SelfApi Verbose: 8 : DotTrace.RunConsole: Runner started.
JetBrains.Profiler.SelfApi Verbose: 9 : dotTrace command-line profiler 2022.3.2 build 777.0.20230125.120904. Copyright (C) 2022 JetBrains s.r.o.
JetBrains.Profiler.SelfApi Verbose: 10 : Preparing to profile...
...
JetBrains.Profiler.SelfApi Verbose: 11 : The command hasn't been executed: accepted
JetBrains.Profiler.SelfApi Verbose: 12 : Unable to start profiling. Profiler attach failed (HRESULT: 0x80004005).
2023-02-07 21:33:12.0068|Failure System.InvalidOperationException: dotTrace console profiler has exited unexpectedly. See details below.
2023-02-07 21:33:12.0068|Failure System.InvalidOperationException: dotTrace console profiler has exited unexpectedly. See details below.
Unhandled exception.*** Standard Error ***
The command hasn't been executed: accepted
System.InvalidOperationException: dotTrace console profiler has exited unexpectedly. See details below.
*** Standard Error ***
The command hasn't been executed: accepted
Unable to start profiling. Profiler attach failed (HRESULT: 0x80004005).

*** Standard Output ***
dotTrace command-line profiler 2022.3.2 build 777.0.20230125.120904. Copyright (C) 2022 JetBrains s.r.o.
Preparing to profile...

   at JetBrains.Profiler.SelfApi.Impl.ConsoleProfiler.BuildException(String caption)
   at JetBrains.Profiler.SelfApi.Impl.ConsoleProfiler.AwaitConnected(Int32 milliseconds)
   at JetBrains.Profiler.SelfApi.DotTrace.Session.AwaitConnected(Int32 milliseconds)
   at JetBrains.Profiler.SelfApi.DotTrace.Attach(Config config)
...
*** Standard Output ***
dotTrace command-line profiler 2022.3.2 build 777.0.20230125.120904. Copyright (C) 2022 JetBrains s.r.o.
Preparing to profile...

   at JetBrains.Profiler.SelfApi.Impl.ConsoleProfiler.BuildException(String caption)
   at JetBrains.Profiler.SelfApi.Impl.ConsoleProfiler.AwaitConnected(Int32 milliseconds)
   at JetBrains.Profiler.SelfApi.DotTrace.Session.AwaitConnected(Int32 milliseconds)
   at JetBrains.Profiler.SelfApi.DotTrace.Attach(Config config)
...
(process 8676) exited with code 0.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .

What would be the potential workaround for such issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions