Skip to content

Commit

Permalink
Fix IOperation debugging experience (#74997)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjonescz authored Sep 6, 2024
1 parent 43fbad7 commit 6ad9d42
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/Compilers/Test/Core/Compilation/CompilationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,7 @@ public static void ValidateIOperations(Func<Compilation> createCompilation)
var compilation = createCompilation();
var roots = ArrayBuilder<(IOperation operation, ISymbol associatedSymbol)>.GetInstance();
var stopWatch = new Stopwatch();
if (!System.Diagnostics.Debugger.IsAttached)
{
stopWatch.Start();
}
start(stopWatch);

void checkTimeout()
{
Expand Down Expand Up @@ -346,13 +343,21 @@ void checkTimeout()

stopWatch.Stop();
checkControlFlowGraph(root, associatedSymbol);
stopWatch.Start();
start(stopWatch);
}

roots.Free();
stopWatch.Stop();
return;

static void start(Stopwatch stopWatch)
{
if (!System.Diagnostics.Debugger.IsAttached)
{
stopWatch.Start();
}
}

void checkControlFlowGraph(IOperation root, ISymbol associatedSymbol)
{
switch (root)
Expand Down

0 comments on commit 6ad9d42

Please sign in to comment.