Skip to content

Commit

Permalink
Fix InvalidOperationException in DotMemoryDiagnoser
Browse files Browse the repository at this point in the history
If a DotMemoryDiagnoser instance is reused and previous AfterActualRun failed,
we shouldn't throw on the second attempt to init the tool
  • Loading branch information
AndreyAkinshin committed Aug 6, 2024
1 parent 3d34edb commit 23e6c52
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ public void Handle(HostSignal signal, DiagnoserActionParameters parameters)
switch (signal)
{
case HostSignal.BeforeAnythingElse:
if (tool is not null)
throw new InvalidOperationException("DotMemory tool is already initialized");
tool = new DotMemoryTool(logger, nugetUrl, downloadTo: toolsDownloadFolder);
tool.Init();
if (tool is null)
{
tool = new DotMemoryTool(logger, nugetUrl, downloadTo: toolsDownloadFolder);
tool.Init();
}
break;
case HostSignal.BeforeActualRun:
if (tool is null)
Expand Down

0 comments on commit 23e6c52

Please sign in to comment.