Microsoft Reference Source is a Good Friend
With recent versions of .Net, Microsoft has provided reference source to allow you to navigate and debug issues with the .Net framework. The reference source website is a great tool to have in your back pocket when researching how something in the .Net framework works. You can download a full solution (minus some resource files) for use in Visual Studio or you can link directly to a line of code when sending emails or instant messages to colleagues.
Recently I was working with the Managed AddIn Framework, and I was trying to determine how to load settings for an AddIn. I did some reading and really didn't find much on the subject. I tried creating a .config
file for the AddIn and magically it was able to load the settings from there. I don't like magic in my code, so I wanted to know how the settings were being loaded. I downloaded the reference source and was able to dig into the AddInActivator class and find the calls into the AddInServer. Inside that code, I found that they explicitly load the configuration file based on the AddIn assmebly name:
AppDomain domain;
AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationBase = Path.GetDirectoryName(token._addin.Location);
setup.ConfigurationFile = token._addin.Location + ".config";
I then took this information and was able to build up a nice email to my colleagues with links directly to the lines of code that we needed to understand to know how the MAF framework loaded configuration files.
I encourage every .Net developer to get a copy of the reference source on your machine and leverage it when you need to get a better understanding of how the .Net framework works.