NullReferenceException at CombresLink when calling GetResourceSet

Feb 8, 2011 at 3:56 AM

I succesfully implemented Combres in an entire site, but this site has regular restartings (asp.net restarting, because of errors and others things).

I notice then, this error after some hours: (the error was solved just making the asp.net re-read web.config file just changing space somewhere).

Importante Note: The error is shown when web is navigated, not the resource.

Server Error in '/' 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:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   Combres.WebExtensions.GetResourceSet(String setName) in F:\Combres\combres_fecb3ce12157\Combres\API\WebExtensions.cs:268
   Combres.WebExtensions.CombresLink(String setName, Object htmlAttributes) in F:\Combres\combres_fecb3ce12157\Combres\API\WebExtensions.cs:143
   ASP.mpstartpage_master.__Render__control2(HtmlTextWriter __w, Control parameterContainer) +165
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +114
   System.Web.UI.HtmlControls.HtmlHead.RenderChildren(HtmlTextWriter writer) +22
   System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +41
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +239
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +239
   System.Web.UI.Page.Render(HtmlTextWriter writer) +37
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4239


Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4955

 

And here is the possible call (taking in mind the function signature)

<!--[if IE]>
    <%= Combres.WebExtensions.CombresLink("menu_ieCss",  new { media = "screen" }) %>
    <![endif]-->

Any Idea about cause of this strange error?

Any help will be very appreciated.

Feb 8, 2011 at 11:09 AM

Looks like Configuration.GetSettings() returns null.  If you read the source of that method, you'll see that it's not possible for it to return null unless there's external interference.  I suspect there's an application thread somewhere that removes stuff in Application state, which Combres uses to store the resource object model.

Feb 8, 2011 at 12:43 PM

Ok I will check for that and I will let you know later.

Thanks!

Feb 8, 2011 at 5:36 PM

OMG!, did gonna be easy to change storage of Combres from Application[] to another like Cache[] eg. ? do you recommend that?

Feb 14, 2011 at 10:08 AM

Is there another thread removing everything in Application state?  If that's the case, I guess the easiest solution is modifying that part of the code to leave Combres' state untouched.