Discovering inner exceptions
When we are building the content of our Views, we often make the odd typographical mistake here and there. Perhaps, we mistype the name of one of our properties in a binding path, or copy and paste some code that references other code that we have not copied.
At first, it may appear to be quite difficult to find the source of these types of errors, because when we run our application, the actual error that is raised by Visual Studio is usually of type XamlParseException
and bares no direct relation to the actual error. The additional information provided is also of little help. Here is a typical example.
Let's investigate this further. We can see that the additional information supplied here says-'Provide value on 'System.Windows.Markup.StaticResourceHolder' threw an exception.' Line number '48' and line position '41'
.
Now let's try to break this down to some meaningful information. Firstly, it is clear that the exception was thrown by the System.Windows.Markup...