NullReferenceException using Scaffolding in RC3

6 views
Skip to first unread message

Patrick Steele

unread,
Nov 18, 2007, 4:35:46 PM11/18/07
to CastleProject-Users
Has anyone ever encountered a NullReferenceException while using
Scaffolding in Monorail (RC3)? I've got a pretty simple project with
about 10 or 12 ActiveRecord classes defined. I wanted to do some
quick data entry so I whipped up a class, inherited from Controller
and applied a Scaffolding attribute to it. However, I'm getting a
NullReferenceException when I visit the "list" page. Here's the stack
trace:

[NullReferenceException: Object reference not set to an instance of an object.]
Castle.MonoRail.Framework.ControllerLifecycleExecutor.PerformErrorHandling()
+72
Castle.MonoRail.Framework.ControllerLifecycleExecutor.ProcessSelectedAction(IDictionary
actionArgs) +543
Castle.MonoRail.Framework.MonoRailHttpHandler.Process(IRailsEngineContext
context) +359
Castle.MonoRail.Framework.MonoRailHttpHandler.ProcessRequest(HttpContext
context) +18
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+303
System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously) +64

I've gone over my (pretty simple) ActiveRecord definition a hundred
times and can't see why it's not working. I changed my typeof() in my
Scaffolding attribute on my controller to one of my simpler types (no
IList's or anything -- just strings and doubles) and I get the same
exception. I then started trying all of my ActiveRecord types for the
typeof() parameter on Scaffolding and they all give the same
NullReferenceException so I don't think it's something with the
ActiveRecord class I first tried -- every one is giving me the exact
same exception.

Does this ring a bell with anyone? I don't want to bore the list with
long dumps of my class definitions since I think it's probably a setup
issue. I just can't find where it is.

Thanks.

Patrick Steele

unread,
Nov 18, 2007, 4:53:28 PM11/18/07
to CastleProject-Users
Ok -- time to be really embarassed...

I was in such a hurry to get this working I had forgotten to add the
activerecord configuration in web.config AND I forgot to initialize
ActiveRecord in the application_onstart.

Hopefully, this helps someone out in the future.

Hamilton Verissimo

unread,
Nov 18, 2007, 7:57:12 PM11/18/07
to castle-pro...@googlegroups.com
Looks like we need to add some safeguards to this situation.


--
Cheers,
hamilton verissimo
ham...@castlestronghold.com
http://www.castlestronghold.com/

Reply all
Reply to author
Forward
0 new messages