0

Is there a way to get useful information out of VS when XAML throws a NullReferenceException? Right now, I am looking at the following:

Message "System.NullReferenceException: Object reference not set to an instance of an object.
 at XamlInspector.Model.XamlElement..ctor(FrameworkElement element, XamlElement parent, Int32 nestingLevel)
 at XamlInspector.Model.XamlElement.<Refresh>b__10(FrameworkElement e)
 at XamlInspector.Foundation.EnumerableExtensions.ForEach[T](IEnumerable`1 enumeration, Action`1 action)
 at XamlInspector.Model.XamlElement.Refresh()
 at XamlInspector.Model.XamlElement.get_Children()
 at XamlInspector.Model.Xaml"   string

As far as I can tell, it does not tell me what object had a null reference, what file generated the exception, or give me a call stack other than the exception handler. Is there a way to get some useful information from VS?

Grant Winney
  • 65,241
  • 13
  • 115
  • 165
William Jockusch
  • 26,513
  • 49
  • 182
  • 323
  • Post your XAML, are you passing anything inside the constructor? – Sajeetharan Apr 19 '14 at 02:20
  • Usually you won't even get as much. Perhaps you can enable breaking on first chance exceptions for CLR (Ctrl+Alt+E window), but often you can learn the most by just... yes, undoing your changes and cutting out bits and pieces of code to see where it fails. – Filip Skakun Apr 19 '14 at 06:05
  • Possible duplicate of [What is a NullReferenceException and how do I fix it?](http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) – Nasreddine Oct 04 '15 at 09:07

0 Answers0