[Mono-dev] Controls in HTML comment block behave different in .Net and Mono

Arnhoffer Károly karnhoffer at ecron.hu
Sun Feb 5 09:35:44 EST 2006


When I have an ASP.Net control in an HTML comment block of an aspx page it does not compile under Mono but it does compile under .Net.

Exmple aspx:

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="MonoCharsetTest.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
		<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
		<meta name="CODE_LANGUAGE" Content="C#">
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
		<meta name="Content-Type" content="text/html; charset=utf-8">
		<form id="Form1" method="post" runat="server">
			<INPUT id="Button1" type="button" value="Button" name="Button1" runat="server">

Example cs:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace MonoCharsetTest
	/// <summary>
	/// Summary description for WebForm1.
	/// </summary>
	public class WebForm1 : System.Web.UI.Page
		protected System.Web.UI.HtmlControls.HtmlInputButton Button1;
		private void Page_Load(object sender, System.EventArgs e)
			// Put user code to initialize the page here

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
			this.Load += new System.EventHandler(this.Page_Load);



Results when running on mono: 

Server error in '/c' application


Description: Error processing request. 
Error Message: HTTP 500. 

Stack Trace: System.NullReferenceException: Object reference not set to an instance of an object
in <0x00012> MonoCharsetTest.WebForm1:Page_Load (System.Object sender, System.EventArgs e)
in (wrapper delegate-invoke) System.MulticastDelegate:invoke_void_object_EventArgs (object,System.EventArgs)
in <0x00117> System.Web.UI.Control:OnLoad (System.EventArgs e)
in <0x000e5> System.Web.UI.Control:LoadRecursive ()
in <0x0011e> System.Web.UI.Page:InternalProcessRequest ()
in <0x000a4> System.Web.UI.Page:ProcessRequest (System.Web.HttpContext context)
With .Net I get a page without the button and no compilation error.

Wich is the right behaviour?
VS.Net project, Mono and .Net results are attached.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060205/fb1a79a7/attachment.htm 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060205/fb1a79a7/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: project.zip
Type: application/x-zip-compressed
Size: 11512 bytes
Desc: project.zip
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060205/fb1a79a7/attachment.bin 

More information about the Mono-devel-list mailing list