After adding the Loupe Agent (and possibly the Loupe Agent for ASP.NET WebForms or ASP.NET MVC) to your ASP.NET MVC application you discover that on some computers the web application will appear to hang on startup, usually in a call to RegisterAllAreas


This is due to a deadlock within the .NET runtime between the performance counter system and the reflection API which is used by RegisterAllAreas (and there may be other paths that will ultimately lead to the same reflection API lock).  The Loupe Agent is blocked in a call to query computer performance counters and while in that call it is holding a lock required by the reflection API.


The true fix to this issue is to correct the performance counter problem on the affected computer.  This generally requires reinstalling the OS on the computer which is often not feasible.  For more information, see PerformanceCounter hang when using VS 2012 + IIsExpress8 (see additional notes below).  Alternately, disable the Loupe Agent from interacting with the Performance Counter API by setting the following in your configuration in the listener section:

  • EnableDiskPerformance: False
  • EnableMemoryPerformance: False
  • EnableNetworkPerformance: False
  • EnableProcessPerformance: False (this can often be left as true and still work because it uses a different path to the performance data)
  • EnableSystemPerformance: False

For more information on these options, see the Listener Configuration section in the documentation.

Since this disables the various ways the Loupe Agent interacts with the performance counters you will not have any performance counter data in the resulting session.  We recommend you not do this as a blanket disable since the performance data is often useful for diagnosing problems but instead reserve it for a situation where the computer has the problem.  

In our experience, this issue is exceedingly rare on servers instead showing up on desktop computers.  This is likely due to a particular peripheral driver introducing the problem which is not commonly used on servers.

While the Microsoft KB article referred to for fixing the performance counters lists a very long and complicated procedure, we've found that just following this will usually resolve the issue:

To rebuild all Performance counters including extensible and third-party counters in Windows, type the following commands at a command prompt. Press ENTER after each command.


lodctr /R


  • /R is uppercase. You must have administrative rights on the computer to successfully perform this command.