Code change request

Aug 27, 2013 at 10:05 PM

Please modify the
protected virtual ViewEngineResult TryGetView(string searchPath)
method of ViewEngine (around line 285) so that the catch provides useful information. My recommendation is:
 catch  (Exception ex)
    // Note, if you get an error here, it is most likely due to something
    // invalid in your view.  Look at the inner exception for details to help 
    // you with this.
    LoggingMediator.Log("Probable view error. please put a break point and look at the inner exception", LogEventType.Exception);       
This should help people (especially newer FW users) identify problems.


Sep 4, 2013 at 11:04 PM
Aren't you already getting a very verbose error when a view is not found? The way it currently works is that the framework gives all the registered view engines the opportunity to search for views. If one of them doesn't find one, that isn't necessarily cause for concern, because the next view engine may still find the desired view. For instance, if you have the loose XAML view engine and the compiled XAML view engine installed (which is the default), then no loose view may be found, but a compiled one will. So in that case, you wouldn't want to see an error from the loose XAML engine. If however NONE of the registered engines find the view, then you need detailed information about where the different engines looked for the view. Which is what the framework currently does.

Or am I misinterpreting the scenario you are referring to?

Sep 5, 2013 at 6:20 PM
My issue was more directed to people new to the framework. When something doesn't happen, it can be very frustrating to track down the problem, given all the cool stuff the framework does. So the idea was to provide some indication to the new developer where they may have been tripped up. More of an attempt to avoid repeatedly beating my head against the wall when something doesn't work and I can't figure it out. Hence the hint that only a developer would see.

But your point is good about not necessarily having it log the issue. I wasn't quite aware that it would go on to search other places if this particular code block failed.