A strange one I've been battling for the last few weeks. Applies to VS2022 or VS2026
I noticed that for a tiny number of solutions, Visual Studio would completely freeze for 5-10s whenever a new build action was kicked off for the solution; including something as simple as "Clean" repeatedly.
The size of the project didn't matter, even a single C# file console app would trigger it.
I didn't suspect NCrunch at the time, assuming something what wrong with our VDI environment or graphics drivers.
I finally isolated the problematic use case yesterday. This happens only when:
- NCrunch is installed
- But disabled for the solution
Here's the full detail of my setup and investigation using WPA:
EnvironmentVisual Studio: VS2022/2026
.NET SDK: .NET 9
NCrunch: 5.20.0.2
OS: Windows 11
Running on: VDI with NVIDIA GPU drivers
Hardware acceleration: Disabled/Enabled (no effect)
Steps to ReproduceInstall NCrunch in Visual Studio.
Open a .NET 9 C# solution.
Disable NCrunch for the solution.
Start a build or clean.
Result:
One CPU core is pegged at 100%.
The Visual Studio UI freezes for 5-10s before the build starts.
No disk or network activity.
Enabling NCrunch for the solution or uninstalling it completely prevents the issue.
Trace DetailsHot thread stack (from WPA):
Code:
Stack,Count,Weight (in view) (ms),TimeStamp (s),% Weight
| Microsoft.Build.ni.dll!Microsoft.Build.BackEnd.Logging.LoggingService.WaitForLoggingToProcessEvents(),4523,"4,516.181839",,11.29
| |- mscorlib.ni.dll!System.Threading.WaitHandle.WaitOne(Int32, Boolean)",4426,"4,419.303839",,11.04
| | |- mscorlib.ni.dll!System.Threading.WaitHandle.InternalWaitOne(System.Runtime.InteropServices.SafeHandle, Int64, Boolean, Boolean)",4416,"4,409.316539",,11.02
| | | |- clr.dll!WaitHandleNative::CorWaitOneNative,4385,"4,378.354939",,10.94
| | | | |- clr.dll!Thread::DoAppropriateWait,4189,"4,182.607739",,10.45
| | | | | |- clr.dll!Thread::DoAppropriateWaitWorker,4173,"4,166.630339",,10.41
| | | | | | |- clr.dll!Thread::DoSyncContextWait,4106,"4,099.717239",,10.25
| | | | | | | |- clr.dll!MethodDescCallSite::CallTargetWorker,3151,"3,145.902139",,7.86
| | | | | | | | |- clr.dll!CallDescrWorkerWithHandler,2790,"2,785.351239",,6.96
| | | | | | | | | |- clr.dll!CallDescrWorkerInternal,2763,"2,758.386639",,6.89
| | | | | | | | | | |- WindowsBase.ni.dll!System.Windows.Threading.DispatcherSynchronizationContext.Wait(IntPtr[], Boolean, Int32)",2723,"2,718.436139",,6.79
| | | | | | | | | | | |- clr.dll!SynchronizationContextNative::WaitHelper,2711,"2,706.451639",,6.76
| | | | | | | | | | | | |- clr.dll!Thread::DoAppropriateWait,2630,"2,625.550939",,6.56
| | | | | | | | | | | | | |- clr.dll!Thread::DoAppropriateWaitWorker,2618,"2,613.567439",,6.53
| | | | | | | | | | | | | | |- clr.dll!MsgWaitHelper,2451,"2,446.772239",,6.11
| | | | | | | | | | | | | | | |- VsLog.dll!<PDB not found>,2364,"2,359.881539",,5.90
| | | | | | | | | | | | | | | | |- combase.dll!<PDB not found>,2113,"2,109.212739",,5.27
| | | | | | | | | | | | | | | | | |- combase.dll!<PDB not found>,2105,"2,101.223339",,5.25
| | | | | | | | | | | | | | | | | | |- combase.dll!<PDB not found>,2084,"2,080.250339",,5.20
| | | | | | | | | | | | | | | | | | | |- KernelBase.dll!WaitForMultipleObjectsEx,1931,"1,927.446639",,4.82
| | | | | | | | | | | | | | | | | | | | |- ntdll.dll!ZwWaitForMultipleObjects,1747,"1,744.619493",,4.36
The UI Thread spins continuously in WaitForMultipleObjectsEx while processing what seems to be a huge number of events from VsLog.dll.
No I/O activity during the spike.
NotesOccurs only when NCrunch is installed but disabled for the solution.
Enabling NCrunch or uninstalling it eliminates the problem.
Environment variables such as VSTelemetryOptOut=1 and VSLOGGINGOPTOUT=1 have no effect.