[Mono-bugs] [Bug 58542][Cri] New - MONO Beta 1 Bug: Not supporting Global.asax code behind.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 15 May 2004 03:39:50 -0400 (EDT)

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 davidandrewtaylor@hotmail.com.


--- shadow/58542	2004-05-15 03:39:50.000000000 -0400
+++ shadow/58542.tmp.15829	2004-05-15 03:39:50.000000000 -0400
@@ -0,0 +1,86 @@
+Bug#: 58542
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Severity: 002 Two hours
+Priority: Critical
+Component: Sys.Web
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: davidandrewtaylor@hotmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: MONO Beta 1 Bug: Not supporting Global.asax code behind.
+Description of Problem:
+When creating a very basic MONO test (using the Visual Studio default), a 
+Global.asax (plus code behind file) is created.  This works on MONO by 
+default but as soon as you try to wire up any of the events it breaks 
+with the error "Trying to Attach Events" shown below.  This works 
+perfectly on MS.NET and is a critical error to fix before shipping MONO.  
+(note using inline Global.asax code works, just not code behind).
+Steps to reproduce the problem:
+Global.asax Below:
+<%@ Application Codebehind="Global.asax.cs" Inherits="MONOTest.Global" %>
+Code Behind Below:
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Web;
+using System.Web.SessionState;
+public class Global : System.Web.HttpApplication
+  public Global()
+  {
+    this.BeginRequest += new EventHandler(Global_BeginRequest);
+  }	
+  public void Global_BeginRequest(object sender, System.EventArgs e)
+  {
+    //Do Work any code here will do but in Mono Beta 1 there is a
+    //Framework error when trying to attach this event.
+  }
+Actual Results:
+System.NullReferenceException: Object reference not set to an instance of 
+an object
+in <0x001ad> System.Web.HttpApplicationFactory:AttachEvents 
+in <0x0005f> System.Web.HttpApplication:Startup 
+in <0x0007e> System.Web.HttpApplicationFactory:InitializeFactory 
+in <0x00073> System.Web.HttpApplicationFactory:GetInstance 
+in <0x00132> System.Web.HttpRuntime:InternalExecuteRequest 
+Expected Results:
+It should just work.
+How often does this happen? 
+All the time.
+Additional Information:
+Note that just having a Global.asax file does not cause the error, you 
+need to wire the event up.
+IMPORTANT: I should additionally add that using the inline version (not 
+the VS.NET default) this works in MONO:
+<%@ Application %>
+<Script language="C#" runat="server">
+     public void Application_BeginRequest() {
+         System.Web.HttpContext.Current.Response.Write("Hello from 
+     }
+So the inlined version worked but the Code Behind (my preference is not 
+working in MONO).