“Fun” with ASP.Net 2.0 in Mono 1.1.13.4

  2006-03-08


I tried to get the ASP.Net 2.0 project we’re working on at Synthesys running on Mono. The server runs Debian Linux Etch, and I use the following packages (some of them are preview packages):

  • mono (and related libraries) 1.1.13.4-0pre6
  • mono-xsp2 (and mono-xsp2-base) 1.1.13-1

xsp2 works beautifully, and seems to print out nice debugging information either in the browser on or the server when exceptions are thrown. Unfortunately exceptions are thrown a lot. Here are some of the differences between Microsoft’s and Mono’s ASP.Net 2.0 implementations that I ran into:

  1. Mono does not support Culture="Auto" (or “auto”). Switching to Culture="en-US" works, but isn’t desirable.
  2. CodeFile paths must be absolute from the root of your project. We had a MasterPages folder with a file that specified a CodeFile in the same folder with CodeFile="nameOfCodeFile.cs", but Mono wanted it to be CodeFile="MasterPages/nameOfCodeFile.cs".
  3. Mono seemed to want only integers for measurements in ASP.Net tag attributes that only accept pixel measurements. So “10px” needed to be just “10”. I’m not sure precisely which attributes this applies to as I just changed them all. (I know it does not apply to font sizes.)
  4. Mono 1.1.13 does not contain a definition for Page.Title, only Page.Header.Title. This appears to be fixed in the trunk.
  5. Page.Theme and Page.StyleSheetTheme aren’t supported in 1.1.13, but my new hero, Chris Toshok, just added them.
  6. So far not to bad, but now for the show stopper: my custom SiteMap implementation. A quick glance at Mono’s Class Status page shows SiteMap related classes to be almost done, but I still get the following exception:
    System.NullReferenceException: Object reference not set to an instance of an object
    in <0x0008d> System.Web.SiteMap:Init ()
    in <0x00007> System.Web.SiteMap:get_Provider ()
    in <0x0000a> System.Web.SiteMap:get_CurrentNode ()
    in <0x0000d> MasterPages_default: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 <0x00112> System.Web.UI.Control:LoadRecursive ()
    in <0x00161> System.Web.UI.Control:LoadRecursive ()
    in <0x001c4> System.Web.UI.Page:InternalProcessRequest ()
    in <0x000a7> System.Web.UI.Page:ProcessRequest (System.Web.HttpContext context)

I have high hopes that the next release of Mono will improve ASP.Net 2.0 support considerably. Hopefully I can start helping submit bug reports and testing new features as well!