Monday, August 17, 2015

Visual Studio - Fix slow symbol loading in debug

Here is how I solved the "slow symbol loading" problem in Visual Studio 2012:

Go to Tools -> Options -> Debugging -> General

CHECK the checkmark next to "Enable Just My Code".

Go to Tools -> Options -> Debugging -> Symbols

Click on the "..." button and create/select a new folder somewhere on your local computer to store cached symbols. I named mine "Symbol caching" and put it in Documents -> Visual Studio 2012.

Click on "Load all symbols" and wait for the symbols to be downloaded from Microsoft's servers, which may take a while. Note that Load all symbols button is only available while debugging.

UNCHECK the checkmark next to "Microsoft Symbol Servers" to prevent Visual Studio from remotely querying the Microsoft servers.

Click "OK".

From now on, symbol loading should be much faster.

Note that if you make any changes/downloads to Microsoft assemblies, you may need to go back into the Symbols dialog box and "Load all symbols" again.

Wednesday, August 5, 2015

C# - Test - Accessing Web.config in Test Context

When having for instance a unit test in one project and the need to get settings from web.config in another project. We can actually copy the web.config when building the unit test project to retrieve the properties like this. Insert this in Build Events in project settings.
 copy "$(SolutionDir)\Somesite.Web\Web.config" "$(ProjectDir)$(OutDir)$(TargetFileName).config"