title: Visual Studio 2015 debugger - high performance impact on SqlCommand
body: <p>After upgrading from VS2013 to VS2015, I was shocked by how slow my web application runs with the debugger attached. So I decided to do a comparison between VS2013 and VS2015 using <a href="http://miniprofiler.com/" rel="noreferrer">MiniProfiler</a> to analyze a particularly slow page:</p>
  
  <p><a href="https://i.stack.imgur.com/IaqQY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/IaqQY.png" alt="Comparison in Mini Profiler"></a>
  Interestingly, when debugging using VS2013, the page loads faster under IIS then IIS Express. But when debugging in VS2015, IIS is way slower then IIS Express.</p>
  
  <p>Also, MiniProfiler is indicating that a high proportion of the time is used in SQL-related code. So I tried using <a href="https://www.jetbrains.com/profiler/" rel="noreferrer">dotTrace</a> to profile the page on IIS - once with the VS2015 debugger attached, and once without it attached:</p>
  
  <p><a href="https://i.stack.imgur.com/gMId2.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gMId2.png" alt="dotTrace comparison"></a></p>
  
  <p>It appears that when debugging in VS2015, a very high percentage of CPU time (real time) is spent on SqlCommand.ExecuteReader() whereas with the debugger not attached, that method is pretty efficient.</p>
  
  <p>I've also tested this on another computer with the same results.</p>
  
  <p>My application uses ASP.NET MVC, NHibernate, SQL Server 2014, and I'm using IIS 10</p>
  
  <p>Has anybody else experienced slow application performance with the VS2015 debugger attached, particularly when running SQL commands? Any ideas what the root cause is and how to solve it?</p>