Thursday, July 7, 2016

Loading a configuration file in a separate appdomain

I lost some time today investigating how to load an app.config for a separate domain. My first attempt looked like this:

However the call to ConfigurationManager.AppSettings always returned null. I first thought that I did something wrong when configuring the AppDomainSetup.

I first tried to replace the AppDomainSetup configuration to explicitly load the config settings:

But this did not solve the issue. In the end I discovered that it was the ConfigurationManager.AppSettings that was causing the issue. When I replaced it with the code below, it started to work!

No comments: