[Mono-bugs] [Bug 624914] New: InvalidCastException in get_AppSettings under xsp4 where it works under xsp2

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jul 22 19:56:19 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=624914

http://bugzilla.novell.com/show_bug.cgi?id=624914#c0


           Summary: InvalidCastException in get_AppSettings under xsp4
                    where it works under xsp2
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: x86
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Web
        AssignedTo: mhabersack at novell.com
        ReportedBy: michael at michael.ie
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4

BlogEngine.net 1.6.1 works with xsp2 but throws an exception under xsp4
An example file is included so that when it's placed into the application
directory

The BlogEngine.Net app seems to set up an environment where under xsp4, the
call to ConfigurationManager.AppSettings.Get("BlogEngine.MobileDevices") gives:
System.InvalidCastException: Unable to cast object of type
'System.Configuration.DefaultSection' to type
'System.Collections.Specialized.NameValueCollection'.

It does not repro standalone with the same Web.Config, I haven't been able to
track down what BlogEngine actually changes.

Reproducible: Always

Steps to Reproduce:
1. Recent compile of mono trunk and xsp (I am using r160696)
2. Download BlogEngine.net 1.6.1 from
http://blogengine.codeplex.com/releases/view/39387
3. unzip and add liberal permissions to App_Data/* (chmod +R 777 App_Data/* or
other)
4. There seems to be a hardcoded search for /bin and /Bin, so cp -r Bin bin
5. I enabled  <compilation debug="true"> in Web.Config
6. start xsp4 with your own host
MONO_OPTIONS=--debug=casts  xsp4 --applications
ec2-79-125-58-30.eu-west-1.compute.amazonaws.com:/:/var/www/asp/blog

7. Visit the site in a browser and hit the exception
8. Visit repro.aspx (supplied in bug) and see the same exception
try again using xsp2 and the basic website loads
Actual Results:  
System.InvalidCastException: Unable to cast object of type
'System.Configuration.DefaultSection' to type
'System.Collections.Specialized.NameValueCollection'.
  at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in
/opt/source/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs:176 
  at BlogEngine.Core.Utils..cctor () [0x00000] in <filename unknown>:0 
Version information: Mono Runtime Version: 2.7 (/trunk/mono r160696 Wed Jul 21
20:14:41 UTC 2010); ASP.NET Version: 4.0.30319.1

[System.Reflection.TargetInvocationException]: Exception has been thrown by the
target of an invocation.
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
System.Globalization.CultureInfo culture) [0x000f0] in
/opt/source/mcs/class/corlib/System.Reflection/MonoMethod.cs:231 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[]
parameters) [0x00000] in
/opt/source/mcs/class/corlib/System.Reflection/MethodBase.cs:96 
  at System.Web.HttpApplicationFactory.FireEvent (System.String method_name,
System.Object target, System.Object[] args) [0x00038] in
/opt/source/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs:205 
  at System.Web.HttpApplicationFactory.FireOnAppStart (System.Web.HttpContext
context) [0x0003a] in
/opt/source/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs:217 
  at System.Web.HttpApplicationFactory.GetApplication (System.Web.HttpContext
context) [0x000ca] in
/opt/source/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs:530 
  at System.Web.HttpRuntime.Process (System.Web.HttpWorkerRequest req)
[0x0005e] in /opt/source/mcs/class/System.Web/System.Web/HttpRuntime.cs:479 
[System.TypeInitializationException]: An exception was thrown by the type
initializer for BlogEngine.Core.Utils
  at ASP.global_asax.Application_Start (System.Object sender, System.EventArgs
e) [0x00000] in /var/www/asp/blog/Global.asax:87 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke
(System.Reflection.MonoMethod*,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
System.Globalization.CultureInfo culture) [0x000d5] in
/opt/source/mcs/class/corlib/System.Reflection/MonoMethod.cs:223 
[System.InvalidCastException]: Unable to cast object of type
&#39;System.Configuration.DefaultSection&#39; to type
&#39;System.Collections.Specialized.NameValueCollection&#39;.
  at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in
/opt/source/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs:176 
  at BlogEngine.Core.Utils..cctor () [0x00000] in <filename unknown>:0 

Expected Results:  
Visit to / should return a website
Visit to /repro.aspx should return a configuration string

repro.aspx:

<%@ Page Language="C#" %>
<html>
<body>
<%= ConfigurationManager.AppSettings.Get("BlogEngine.MobileDevices") %>
</body>
</html>

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list