Monday, May 12, 2008

what, me worry about good stack traces?

Those of us fortunate enough to get to build an application inside sharepoint are often confronted with this error message:


Pretty useful, huh?

What you quickly learn is that the real error is usually found in the shared log, which is usually more descriptive. But every now and then you get a real treat like this as your only source of information:

05/12/2008 14:29:32.84 w3wp.exe (0x03A4) 0x0588 Windows SharePoint Services General 8dzz High Exception Type: System.NullReferenceException Exception Message: Object reference not set to an instance of an object.


Those of us familiar with java development are used to seeing worthless NullPointerExceptions like this, except that further down the stack trace is the clue to what's missing. In this case however, you don't get that clue.

Good thing it's so easy to write functional automated tests in sharepoint :)

My wise colleague Jon Jones pointed me to a roundup of great logging and debugging tips by Andrew Connell here.


On a positive note, my talented colleague Brian Kapellusch wrote a nice wrapper around Spring.NET and NHibernate, which our project is using as the container for our business logic and data access. Craptacular? Yes. Needed? Yes. At least until MS finally gets around to producing a production quality MVC framework, which is probably at least a year off. Without it, I'd have a lot tougher time isolating and testing things like this.