[Mono-list] Unit tests load a different configuration file under mono

"Andrés G. Aragoneses" knocte at gmail.com
Sat Aug 10 08:40:06 UTC 2013


This is not related to NUnit. This is exactly bug 11972 which I filed 
here some months ago: https://bugzilla.xamarin.com/show_bug.cgi?id=11972

The problem lies in the fact that whenever any code inside the 
System.Web assembly tries to read the configuration, it replaces the 
System.Configuration infrastructure to the one that is used when a 
ASP.NET app is run.

I have a patch that fixes it, which I proposed in a pull request: 
https://github.com/mono/mono/pull/725 . However, some time later after I 
wrote the fix I realized it was based on false assumptions, and I 
haven't had yet the time to investigate more. Do you mind reading the 
pull request, subscribe to it, and help?

The approach I'm thinking now that may be correct would be replacing all 
config queries in System.Web that use WebConfigurationManager, to start 
using ConfigurationManager instead. But I haven't tested it yet.


On 10/08/13 03:25, Dave Curylo wrote:
> Thanks for the reply. I understand how to get the test framework to load
> a config file, and the first test does just that. It succeeds on both
> platforms.  The second test does the same exact thing, only it makes a
> call to HttpUtility first, and this seems to trip up the
> ConfigurationManager, but only under mono. Under MS .NET, both tests
> succeed in loading the configuration and both pass, but under mono, the
> first test passes and the second test fails because once a call is made
> to HttpUtility, the ConnectionStrings are replaced with the defaults
> from the ASP.NET <http://ASP.NET> stack.  This seems like very odd behavior.
>
> On Friday, August 9, 2013, Charlie Poole wrote:
>
>     Each test framework has it's own requirements for where a config
>     file must be located and how it should be named in order to be
>     loaded and used.
>
>
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>




More information about the Mono-list mailing list