I've looked quite a bit more into this today.  It can be reproduced simply with 
this (nothing to do with unit tests or shadow copies as you said, just happens 
when something in System.Web tries to read the configuration):

        class MainClass
        {
                public static void Main (string[] args)
                {
                        var dom1 = AppDomain.CreateDomain ("dom1");
                        var myCls = dom1.CreateInstanceAndUnwrap 
("ConfigTesting", "ConfigTesting.MyClass") as MyClass;
                        myCls.ReadConfigSettingWeb();
                }
        }
        class MyClass : MarshalByRefObject
        {
                public void ReadConfigSettingWeb() {
                        var c = System.Web.Util.HttpEncoder.Current;
                        var connStr = 
ConfigurationManager.ConnectionStrings["myconn"];
                        if(connStr == null)
                                throw new ConfigurationErrorsException("myconn 
is not found");
                }

        }

The statement "var c = System.Web.Util.HttpEncoder.Current" forces it to load 
the configuration, which works fine in the root AppDomain, but fails when run 
in a second AppDomain.  After staring at profiler output all day and comparing 
with source, I am looking in the direction of the 
WebConfigurationHost.InitForConfiguration method.  I suspect something here is 
redirecting the configuration when in an app domain like it would if it were in 
an ASP.NET virtual application, and if it can't find a config file in whatever 
path it's looking (erroneously) it will fallback on the machine.config.  I 
haven't been able to get the runtime setup so I can step through all of this, 
but will do that soon.

On Aug 10, 2013, at 4:42 AM, Andrés G. Aragoneses <kno...@gmail.com> wrote:

> On 10/08/13 10:40, "Andrés G. Aragoneses" wrote:
> 
> Wrong URL, I meant this one: https://github.com/mono/mono/pull/643
> 
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list

_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to