When I use Visual Studio 2015 to debug a website, using file -> open website... on my local development database, queries slows right down to the point where they take a minute or more instead of milliseconds. Similar queries run by hand using SQL Server Management Studio (SSMS) are slow while Visual Studio is running.
SQL Server instance is running on the same machine as Visual Studio environment.
Here is what I've tried:
The issue still persists after the above, and the problem is resolved when Visual Studio is shut down or a different solution is opened.
I checked the sql connections from SSMS and the connections were cleared once IIS Express process. It appears to be some sort of integration that Visual Studio is instrumenting with SQL Server libraries that is at the root of this.
Anybody have an idea what this might be or how to troubleshoot this further?
Another possible issue is how Visual Studio marshals exceptions. If your code has a bunch of exceptions that are caught in try catch blocks; each exception that is generated is intercepted by Visual Studio regardless of whether you handle them with a try catch. In recent versions of Visual Studio, I have measured about 40 milliseconds per exception. This may not seem like a lot but they add up. I have legacy .net applications that the original developer was prolific with try catch blocks to catch primitive type conversions and null handling.
The only way to get around this is to re-tool the code that generates the exceptions to not generate exceptions where ever possible. In my case, this was a massive undertaking but it paid off. I now have robust primitive type conversions and parsing that is fast when run in the debugger.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With