Skip to content

Commit 8bf5c9c

Browse files
authored
Fix NRE when trying to start the stopwatch (#747)
* Fix NRE when trying to start the stopwatch * Make Stopwatch property threadstatic
1 parent 04efac5 commit 8bf5c9c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/PowerShellEditorServices/Utility/ExecutionTimer.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static ExecutionTimer Start(
5050
[CallerLineNumber] int callerLineNumber = -1)
5151
{
5252
var timer = new ExecutionTimer(logger, message, callerMemberName, callerFilePath, callerLineNumber);
53-
t_stopwatch.Start();
53+
Stopwatch.Start();
5454
return timer;
5555
}
5656

@@ -93,6 +93,6 @@ public void Dispose()
9393
callerLineNumber: _callerLineNumber);
9494
}
9595

96-
private Stopwatch Stopwatch => t_stopwatch ?? (t_stopwatch = new Stopwatch());
96+
private static Stopwatch Stopwatch => t_stopwatch ?? (t_stopwatch = new Stopwatch());
9797
}
9898
}

0 commit comments

Comments
 (0)