title: Object reference not set to an instance - error on server after update/restart
body: <p>I'm hoping you can help me. I'm getting the Object reference error on a webserver which contains an application we run. </p>
  
  <p>Someone reset it this week and updated the server with (about) 50 new updates. I know. terrible. Anyway.. since then we're getting this error.</p>
  
  <blockquote>
    <p>Server Error in '/' Application.</p>
    
    <p>Object reference not set to an instance of an object.</p>
    
    <p>Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.</p>
    
    <p>Source Error: </p>
    
    <p>Line 36:         Hashtable items = mc.LanguageController.GetLanguageItems(ClientConfiguration.Language, languageItems);</p>
    
    <p>Line 37:         XmlElement itemsElem = doc.CreateElement("Lang");</p>
    
    <p>Line 38:         doc.DocumentElement.AppendChild(itemsElem);</p>
    
    <p>Source File: c:\inetpub\wwwroot\xxxxxxxx\www\App_Code\Rendering\Rendering.cs    Line: 36 </p>
    
    <p>Stack Trace: </p>
    
    <p>[NullReferenceException: Object reference not set to an instance of an object.]</p>
    
    <p>Rendering.GetRootDocument(String[] languageItems, IMainController mc) in c:\inetpub\wwwroot\xxxxxxxxxxxx\www\App_Code\Rendering\Rendering.cs:36</p>
    
    <p>Rendering.GetDefaultDocument(IMainController mc) in c:\inetpub\wwwroot\xxxxxxxxxxxx\www\App_Code\Rendering\Rendering.cs:53</p>
    
    <p>_Default.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\xxxxxxxxxxxx\www\Default.aspx.cs:31</p>
    
    <p>System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14</p>
    
    <p>System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35</p>
    
    <p>System.Web.UI.Control.OnLoad(EventArgs e) +99</p>
    
    <p>System.Web.UI.Control.LoadRecursive() +50</p>
    
    <p>System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean  includeStagesAfterAsyncPoint) +627</p>
    
    <p>Version Information: Microsoft .NET Framework Version:2.0.50727.4216; ASP.NET  Version:2.0.50727.4223</p>
  </blockquote>
  
  <p>I've checked the Event log as well:</p>
  
  <blockquote>
    <p>Event code: 3005 </p>
    
    <p>Event message: An unhandled exception has occurred. </p>
    
    <p>Event time: 29-3-2012 12:47:38 </p>
    
    <p>Event time (UTC): 29-3-2012 10:47:38 </p>
    
    <p>Event ID: 69890cf8cf244b18a5adcbd29ae9a189 </p>
    
    <p>Event sequence: 25 </p>
    
    <p>Event occurrence: 8 </p>
    
    <p>Event detail code: 0 </p>
    
    <p>Application information: </p>
    
    <p>Application domain: /LM/W3SVC/2/ROOT-3-129774906346518390 </p>
    
    <p>Trust level: Full </p>
    
    <p>Application Virtual Path: / </p>
    
    <p>Application Path: C:\inetpub\wwwroot\xxxxxxxx\www\ </p>
    
    <p>Machine name: WIN-PKNHIWTOENT </p>
    
    <p>Process information: </p>
    
    <p>Process ID: 4288 </p>
    
    <p>Process name: w3wp.exe </p>
    
    <p>Account name: NT AUTHORITY\NETWORK SERVICE </p>
    
    <p>Exception information: </p>
    
    <p>Exception type: NullReferenceException </p>
    
    <p>Exception message: Object reference not set to an instance of an object. </p>
    
    <p>Request information: </p>
    
    <p>Request URL: <a href="http://xxxxxxxx/default.aspx" rel="nofollow">http://xxxxxxxx/default.aspx</a> </p>
    
    <p>Request path: /default.aspx </p>
    
    <p>User host address: yyy.yyy.yyy.yyy</p>
    
    <p>User:  </p>
    
    <p>Is authenticated: False </p>
    
    <p>Authentication Type:  </p>
    
    <p>Thread account name: NT AUTHORITY\NETWORK SERVICE </p>
    
    <p>Thread information: </p>
    
    <p>Thread ID: 8 </p>
    
    <p>Thread account name: NT AUTHORITY\NETWORK SERVICE </p>
    
    <p>Is impersonating: False </p>
    
    <p>Stack trace:    at Rendering.GetRootDocument(String[] languageItems, IMainController 
    mc) in c:\inetpub\wwwroot\xxxxxxxxxxxx\www\App_Code\Rendering\Rendering.cs:line 36</p>
    
    <p>at Rendering.GetDefaultDocument(IMainController mc) in c:\inetpub\wwwroot\xxxxxxxxxxxx\www\App_Code\Rendering\Rendering.cs:line 53</p>
    
    <p>at _Default.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\xxxxxxxxxxxx\www\Default.aspx.cs:line 31</p>
    
    <p>at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, 
    EventArgs e)</p>
    
    <p>at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)</p>
    
    <p>at System.Web.UI.Control.OnLoad(EventArgs e)</p>
    
    <p>at System.Web.UI.Control.LoadRecursive()</p>
    
    <p>at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean 
    includeStagesAfterAsyncPoint)</p>
  </blockquote>
  
  <p>I suspect it's the languageItems variable, which is being passed from another function:</p>
  
  <blockquote>
    <p>public static XmlDocument GetOverviewDocument(IMainController mc) {</p>
  
  <pre><code>   string[] languageItems = { 
  
        "usermanagement", 
  
        "customermanagement", 
  
        "ordermanagement", 
  
        "ordermanagement LB", 
  
        "systemmanagement",
  
        "qualitymanagement",
  
        "overview",
  
        "loggedinas",
  
        "logout",
  
        "Change password",
  
        "managementoverview"
  
    };
  
   XmlDocument doc = GetRootDocument(languageItems, mc);
  
   return doc;
  </code></pre>
    
    <p>}</p>
  </blockquote>
  
  <p>Since I'm not an ASP guru like most of you I have no idea what's actually happening here; whether it's something to do with the updates to .NET which were installed, if it's code-syntax related or if there's a simple config mistake in web.config which I'm overlooking.</p>
  
  <p>Any help would be most, MOST appreciated.</p>