6
Reply

Help! Object reference...

waterfall

waterfall

Apr 16 2005 4:45 AM
1.9k
Hi! Can someone help me please, I get this error when I run application: Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: Line 52: public bool haveInited Line 53: { Line 54: get { return (bool)Session.Contents["haveInited"]; } Line 55: set { Session.Contents[ "haveInited" ] = value; } Line 56: } Source File: c:\inetpub\wwwroot\oxcet3\oxform.aspx.cs Line: 54 Stack Trace: [NullReferenceException: Object reference not set to an instance of an object.] ox4.Ox4Form.get_haveInited() in c:\inetpub\wwwroot\oxcet3\oxform.aspx.cs:54 ox4.Ox4Form.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\oxcet3\oxform.aspx.cs:66 System.Web.UI.Control.OnLoad(EventArgs e) System.Web.UI.Control.LoadRecursive() System.Web.UI.Page.ProcessRequestMain() Application is C# generated from Prolog, using P# (Jon Cook is author of P#). Here is the link http://www.dcs.ed.ac.uk/home/jjc/psharp/psharp-1.1/dlpsharp.html It is P# example of game Noughts and Crosses. Problematic code is: public bool haveInited { get { return (bool)Session.Contents["haveInited"]; } set { Session.Contents[ "haveInited" ] = value; } } protected System.Web.UI.WebControls.Button[] Cells; private void Page_Load(object sender, System.EventArgs e) { Cells = new Button[] { Cell1, Cell2, Cell3, Cell4, Cell5, Cell6, Cell7, Cell8, Cell9, Cell10, Cell11, Cell12, Cell13, Cell14, Cell15, Cell16 }; if( !haveInited ) { haveInited = true; ResetBoard(); } } It fails on if(!haveInited) line...

Answers (6)