Bugzilla – Bug 319044
XSP System.Runtime.Serialization.SerializationException using ASP.NET with VB-code as codebehind.
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by jan.bouwhuis@solcon.nl 2005-09-20 10:28:10 MST ---- Description of Problem: I compiled my own System.Web from source 20050916 (see https://bugzilla.novell.com/show_bug.cgi?id=MONO76096). Using code behind a VB project fails with about the same errors. Using C# the code works fine. I uses VS 2002 and precompiled on Windows XP. I run mono 1.1.9 with xsp on Suse 9.3. Steps to reproduce the problem: Example code: index.aspx <%@ Page Language="vb" AutoEventWireup="false" Codebehind="index.aspx.vb" Inherits="monotestvb.WebForm1"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <title>test</title> <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0"> <meta name="CODE_LANGUAGE" content="Visual Basic 7.0"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body> <form id="Form1" method="post" runat="server"> <% TestSub() %> </form> </body> </HTML> index.aspx.vb Public Class WebForm1 Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here End Sub Public Sub TestSub() Dim n As Integer For n = 1 To 10 Response.Write(n & "<br>") Next End Sub End Class Actual Results: XSP result: xsp Listening on port: 8080 Listening on address: 0.0.0.0 Root directory: /home/jbouwh/MonoTestVB Hit Return to stop the server. System.Runtime.Serialization.SerializationException: Type System.Web.Compilation.CompilationException is not marked as Serializable. Server stack trace: in <0x000d4> System.Runtime.Serialization.Formatters.Binary.BinaryCommon:CheckSeriali zable (System.Type type, ISurrogateSelector selector, StreamingContext context) in <0x00145> System.Runtime.Serialization.Formatters.Binary.ObjectWriter:GetObjectDat a (System.Object obj, System.Runtime.Serialization.Formatters.Binary.TypeMetadata metadata, System.Object data) in <0x00044> System.Runtime.Serialization.Formatters.Binary.ObjectWriter:WriteObject (System.IO.BinaryWriter writer, Int64 id, System.Object obj) in <0x00108> System.Runtime.Serialization.Formatters.Binary.ObjectWriter:WriteObjectI nstance (System.IO.BinaryWriter writer, System.Object obj, Boolean isValueObject) in <0x0002d> System.Runtime.Serialization.Formatters.Binary.ObjectWriter:WriteQueuedO bjects (System.IO.BinaryWriter writer) in <0x00037> System.Runtime.Serialization.Formatters.Binary.ObjectWriter:WriteObjectG raph (System.IO.BinaryWriter writer, System.Object obj, System.Runtime.Remoting.Messaging.Header[] headers) in <0x00200> System.Runtime.Serialization.Formatters.Binary.BinaryFormatter:Serialize (System.IO.Stream serializationStream, System.Object graph, System.Runtime.Remoting.Messaging.Header[] headers) in <0x00015> System.Runtime.Serialization.Formatters.Binary.BinaryFormatter:Serialize (System.IO.Stream serializationStream, System.Object graph) in <0x00068> System.Runtime.Remoting.RemotingServices:SerializeExceptionData (System.Exception ex) Exception rethrown at [0]: in (wrapper xdomain-invoke) Mono.WebServer.XSPApplicationHost:ProcessRequest (int,long,int,long,int,string,string,string,string,byte [],string,intptr,Mono.WebServer.SslInformations) in (wrapper remoting-invoke-with-check) Mono.WebServer.XSPApplicationHost:ProcessRequest (int,long,int,long,int,string,string,string,string,byte [],string,intptr,Mono.WebServer.SslInformations) in <0x0062c> Mono.WebServer.XSPWorker:Run (System.Object state) Expected Results: A working application. How often does this happen? Every Time Additional Information: The code worked in version 1.1.8 ---- Additional Comments From gonzalo@ximian.com 2005-09-20 20:38:04 MST ---- The exception is a problem with mbas compiling the code. System.Web no longer throws that serialization exception when it gets the compilation error. Moving this to VB. ---- Additional Comments From jan.bouwhuis@solcon.nl 2005-09-21 02:30:06 MST ---- There might be a possible relation to bug: 74670 Only in this case the codebehind is pre compiled. ---- Additional Comments From jan.bouwhuis@solcon.nl 2005-09-23 15:47:17 MST ---- I now installed version 1.1.9-1 (22 sep 2005). The SerilizationExeption is now gone. The screen now displays an error quite similar to the one in https://bugzilla.novell.com/show_bug.cgi?id=MONO74670. Error after installing version 1.1.9-1 (XSP is not displaying an exception to the console anymore): Server Error in '/' Application --------------------------------------------------------------------- ----------- Compilation Error Description: Error compiling a resource required to service this request. Review your source file and modify it to fix this error. Error message: /tmp/jbouwh-temp-aspnet-0/dac491ae/83737.0.vb(35,0) : error BC30201: Expression expected /tmp/jbouwh-temp-aspnet- 0/dac491ae/83737.0.vb(36,43) : error BC30201: Expression expected /tmp/jbouwh-temp-aspnet-0/dac491ae/83737.0.vb(38,16) : error BC30087: 'End If' is not having a corresponding 'If' /tmp/jbouwh-temp-aspnet-0/dac491ae/83737.0.vb (41,11) : error BC29999: Parsing error File name: /home/jbouwh/MonoTestVB/Global.asax Source File: /tmp/jbouwh-temp-aspnet-0/dac491ae/83737.0.vb Line 1: ' ----------------------------------------------------------- ------------------- Line 2: ' <autogenerated> Line 3: ' This code was generated by a tool. Line 4: ' Mono Runtime Version: 1.1.4322.573 Line 5: ' Line 6: ' Changes to this file may cause incorrect behavior and will be lost if Line 7: ' the code is regenerated. Line 8: ' </autogenerated> Line 9: ' ----------------------------------------------------------- ------------------- Line 10: Line 11: Option Explicit On Line 12: Option Strict Off Line 13: Line 14: Imports System Line 15: Imports System.Collections Line 16: Imports System.Collections.Specialized Line 17: Imports System.Configuration Line 18: Imports System.Text Line 19: Imports System.Text.RegularExpressions Line 20: Imports System.Web Line 21: Imports System.Web.Caching Line 22: Imports System.Web.Security Line 23: Imports System.Web.SessionState Line 24: Imports System.Web.UI Line 25: Imports System.Web.UI.WebControls Line 26: Imports System.Web.UI.HtmlControls Line 27: Line 28: Namespace ASP Line 29: Public Class Global_asax Line 30: Inherits monotestvb.Global Line 31: Line 32: Private Shared __intialized As Boolean = false Line 33: Line 34: Public Sub New() Line 35: MyBase.New Line 36: If ((ASP.Global_asax.__intialized = false)) Then Line 37: ASP.Global_asax.__intialized = true Line 38: End If Line 39: End Sub Line 40: End Class Line 41: End Namespace --------------------------------------------------------------------- ----------- ---- Additional Comments From jan.bouwhuis@solcon.nl 2005-09-24 13:46:29 MST ---- When parsing the ASP.NET code, some code needs to be injected: Line 34: Public Sub New() Line 35: MyBase.New Line 36: If ((ASP.Global_asax.__intialized = false)) Then Line 37: ASP.Global_asax.__intialized = true Line 38: End If Line 39: End Sub MBAS seems not to be able to deal with MyBase.New If the code would include brackets like: MyBase.New() MBAS would parse the code correctly. 2 possible solutions: 1) Inject MyBase.New() instead of MyBase.New 2) Enable MBAS to parse a Sub or Function without brackets if they have no parameters. ---- Additional Comments From saadis01@gmail.com 2005-10-20 18:34:34 MST ---- I'm getting the same message, running Mono 1.1.9.2 on Windows XP. Line 34: Public Sub New() Line 35: MyBase.New Line 36: If ((ASP.Global_asax.__intialized = false)) Then Line 37: ASP.Global_asax.__intialized = true Line 38: End If Line 39: End Sub Line 40: End Class Line 41: End Namespace ---- Additional Comments From jan.bouwhuis@solcon.nl 2005-11-21 15:22:37 MST ---- After installing version 1.1.10 this bug seems to be a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO76569. Previous errors seem te be fixed. https://bugzilla.novell.com/show_bug.cgi?id=MONO76569 *** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO76569 *** This bug depended on bug(s) 60401 76096. Unknown bug field "cf_op_sys_details" encountered while moving bug <cf_op_sys_details>actual using Suse 9.3</cf_op_sys_details> Unknown operating system SUSE 9.2. Setting to default OS "Other". This bug was marked DUPLICATE in the database it was moved from. Changing resolution to "MOVED"