[Mono-bugs] [Bug 79193][Nor] New - InvalidCastException when using ConfigurationSettings and nunit-console2

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Aug 28 09:12:34 EDT 2006

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by mono at middlesoft.co.uk.


--- shadow/79193	2006-08-28 09:12:34.000000000 -0400
+++ shadow/79193.tmp.10007	2006-08-28 09:12:34.000000000 -0400
@@ -0,0 +1,56 @@
+Bug#: 79193
+Product: Mono: Tools
+Version: 1.1
+OS Details: Linux 2.6.17-ARCH #1 SMP PREEMPT
+Status: NEW   
+Priority: Normal
+Component: tools
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: mono at middlesoft.co.uk               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: InvalidCastException when using ConfigurationSettings and nunit-console2
+Description of Problem:
+When using nunit-console2 that comes with mono, if a test calls
+System.Configuration.ConfigurationSettings.AppSettings["foo"] then an
+InvalidCastException is thrown.  This doesn't happen if the code is
+executed as an executable.
+Steps to reproduce the problem:
+1. Use the attached test.cs.
+2. Compile using gmcs -r:/usr/lib/mono/1.0/nunit.framework.dll test.cs
+- The same result occurs if linked to a 2.0 profile dll.  I tested with the
+2.0 version that ships with NAnt and the net-2.0 version that ships with
+the precompiled nunit.
+3. Run using nunit-console2 test.exe
+Actual Results:
+1) MyTest.DoTest : System.InvalidCastException : Cannot cast from source
+type to destination type.
+  at System.Configuration.ConfigurationSettings.get_AppSettings () [0x00000]
+  at MyTest.DoTest () [0x00000]
+  at <0x00000> <unknown method>
+  at (wrapper managed-to-native)
+System.Reflection.MonoMethod:InternalInvoke (object,object[])
+  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
+invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
+System.Globalization.CultureInfo culture) [0x00040] in
+Expected Results:
+Test should past
+How often does this happen? 
+All the time.
+Additional Information:
+This problem manifests itself when using log4net and nunit together on mono
+when trying to run a 2.0 profile suite of unit tests.

More information about the mono-bugs mailing list