[Mono-list] First load error

Lorenzo Viola info at eulogika.net
Fri Sep 14 02:08:46 EDT 2007



Hello, I'm struggling on this problem from 2 days, I need some help...

I'm developing a website using vs2005,and then I deploy it to a debian / 
apache2 / mod-mono box

On the windows machine (vista + iis) I get no problem...when launching 
the application
from a browser on the linux machine, the first time a user browse the 
home page gets the below message...

refreshing the page, the problem gets away, without problem.

My real problem is that I can't get a real debug...

On mono, there is some variable still null at startup...
but I can't find which it is...


I've tried :
Console.Error.WriteLine(ex);

But I get no error inside the apache2 log...

The only way I found, is to place inside global.asax the following :

    void Application_Error(object sender, EventArgs e)
    {
        string EventLogFile = "/var/www/xxxxxxxxxx/xxxxxx.log";
        StreamWriter sw = new StreamWriter(File.OpenWrite(EventLogFile));
        sw.AutoFlush = true;
               
        string sError = Server.GetLastError().ToString();
        string sTrace = Server.GetLastError().StackTrace.ToString();
        sw.WriteLine("###################### ERROR ");
        sw.WriteLine(sError);
               
        string sErrorInner, sTraceInner;
        if (Server.GetLastError().InnerException != null)
        {
            sErrorInner = Server.GetLastError().InnerException.ToString();
            sTraceInner = 
Server.GetLastError().InnerException.StackTrace.ToString();
            sw.WriteLine("###################### ERROR INNER ");
            sw.WriteLine(sErrorInner);             
        }      
        sw.Close();
    }


but I get the same message below...

I read about the tracing system, but it looks an overhead to me...

There is any other way than installing a whole linux system with some 
IDE like monodevelop ?
it takes a lot of time...


Best Regards



ps...the only strange thing I do is loading at preinit a different 
masterpage...


    protected override void OnPreInit(EventArgs e)
    {
        try
        {
            GetCookie();

            string sMPFile = "~/templates/t" + Session["soc"] + 
"_home.master";
            if (Session["op"].ToString() == "page")
                sMPFile = "~/templates/t" + Session["soc"] + "_page.master";

            base.MasterPageFile = sMPFile;
            base.OnPreInit(e);
        }
        catch (Exception ex)
        {
            Console.Error.WriteLine(ex);
            throw;
        }
    }



(this is error I get...)


  Server Error in '/' Application

------------------------------------------------------------------------


    /Object reference not set to an instance of an object/

*Description: *Error processing request.

*Error Message: *HTTP 500. System.NullReferenceException: Object 
reference not set to an instance of an object

*Stack Trace: *

System.NullReferenceException: Object reference not set to an instance of an object
  at ASP.templates_tcub_home_master.__Render_form1 (System.Web.UI.HtmlTextWriter __output, System.Web.UI.Control parameterContainer) [0x00000] 
  at (wrapper delegate-invoke) System.MulticastDelegate:invoke_void_HtmlTextWriter_Control (System.Web.UI.HtmlTextWriter,System.Web.UI.Control)
  at System.Web.UI.Control.RenderChildren (System.Web.UI.HtmlTextWriter writer) [0x00000] 
  at System.Web.UI.HtmlControls.HtmlForm.RenderChildren (System.Web.UI.HtmlTextWriter w) [0x00000] 
  at System.Web.UI.HtmlControls.HtmlContainerControl.Render (System.Web.UI.HtmlTextWriter writer) [0x00000] 
  at System.Web.UI.HtmlControls.HtmlForm.Render (System.Web.UI.HtmlTextWriter w) [0x00000] 
  at System.Web.UI.Control.RenderControl (System.Web.UI.HtmlTextWriter writer) [0x00000] 
  at System.Web.UI.HtmlControls.HtmlForm.RenderControl (System.Web.UI.HtmlTextWriter w) [0x00000] 
  at System.Web.UI.Control.RenderChildren (System.Web.UI.HtmlTextWriter writer) [0x00000] 
  at System.Web.UI.Control.Render (System.Web.UI.HtmlTextWriter writer) [0x00000] 
  at System.Web.UI.Control.RenderControl (System.Web.UI.HtmlTextWriter writer) [0x00000] 
  at System.Web.UI.Control.RenderChildren (System.Web.UI.HtmlTextWriter writer) [0x00000] 
  at System.Web.UI.Control.Render (System.Web.UI.HtmlTextWriter writer) [0x00000] 
  at System.Web.UI.Page.Render (System.Web.UI.HtmlTextWriter writer) [0x00000] 
  at System.Web.UI.Control.RenderControl (System.Web.UI.HtmlTextWriter writer) [0x00000] 
  at System.Web.UI.Page.InternalProcessRequest () [0x00000] 
  at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] 

------------------------------------------------------------------------
09/14/2007 06:10:35
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20070914/58df033f/attachment-0001.html 


More information about the Mono-list mailing list