why does ShellRoute.EndProcessRequest() suppress exceptions?

Topics: Core, Customizing Orchard
Feb 26, 2014 at 10:00 AM
Edited Feb 26, 2014 at 10:00 AM
I had a bug today where a web page was coming up completely blank. It took me over an hour to find out the problem because it was only happening on one server, and nothing was being logged, and nothing was in the view source of the page.

Eventually I found that the reason was that a module had not been enabled, causing a shape not to be found. This was causing an exception to be raised, but there was no output anywhere to indicate this. I discovered that the top of the stack was suppressing the exception - namely Orchard.Mvc.Routes.ShellRoute.EndProcessRequest():
        public void EndProcessRequest(IAsyncResult result) {
            try {
            finally {  // no catch/log/throw?? just hide the problem?
Why does it suppress the exception? Is it protecting a particular scenario?

Is it safe to put a catch/throw in there - like the code in BeginProcessRequest()?
Feb 26, 2014 at 2:01 PM
There is no catch, so I don't think this suppresses exceptions (just makes sure to run Dispose(), anything happens). Nevertheless it's strange because a missing shape template, if the execution happens in a request, should cause a YSOD.
Feb 26, 2014 at 2:16 PM
Edited Feb 26, 2014 at 2:34 PM
Doh! Yes, on reflection, you're right, it should bubble anyway without a catch.

I guess it must have been suppressed elsewhere then.

I couldn't recreate the blank screen locally, only a YSOD.

All I know for sure is that the blank screen on the server was caused by a missing shape. If I see the problem again, I'll update.
Feb 26, 2014 at 3:06 PM
Are you using any caching mechanism?