[Mono-dev] RoleManagerModule NRE

Joshua Tauberer jit at occams.info
Mon Mar 10 07:32:08 EDT 2008


Hi,

Occasionally I am seeing in my website a NRE in 
System.Web.Security.RoleManagerModule as follows:

System.NullReferenceException: Object reference not set to an instance 
of an object
   at System.Web.Security.RoleManagerModule.OnPostAuthenticateRequest 
(System.Object sender, System.EventArgs args) [0x00007] in 
/tmp/monobuild/build/BUILD/mono-1.9/mcs/class/System.Web/System.Web.Security/RoleManagerModule.cs:65 

   at System.Web.HttpApplication+<>c__CompilerGenerated1.MoveNext 
() [0x001d9] in 
/tmp/monobuild/build/BUILD/mono-1.9/mcs/class/System.Web/System.Web/HttpApplication.cs:793 

   at System.Web.HttpApplication+<>c__CompilerGenerated2.MoveNext 
() [0x002fd] in 
/tmp/monobuild/build/BUILD/mono-1.9/mcs/class/System.Web/System.Web/HttpApplication.cs:913 

   at System.Web.HttpApplication.Tick () [0x00000] in 
/tmp/monobuild/build/BUILD/mono-1.9/mcs/class/System.Web/System.Web/HttpApplication.cs:697

The offending line is accessing a private field (_config) that has not 
been initialized yet. It suggests that the problem is in the class's 
IHttpModule.Init, where it adds its event handlers to the 
HttpApplication *before* initializing _config, and an event handler is 
being called in the middle.

Is this a symptom of a larger problem --- i.e. event handlers should not 
be called until Init returns --- or is this a bug in this module and 
_config should be initialized first? (RoleManagerModule has been like 
this since r74728, 2007-03-21.)

-- 
- Josh Tauberer

http://razor.occams.info

"Yields falsehood when preceded by its quotation!  Yields
falsehood when preceded by its quotation!" Achilles to
Tortoise (in "Godel, Escher, Bach" by Douglas Hofstadter)


More information about the Mono-devel-list mailing list