Tracking down bugs in XAML
-
Hi All, Does anyone have any tips on tracking down hard to find problems in XAML? My application runs without any hitches and everything works as designed. Blend opens the solution and displays the main window with out any errors or problems building the solution. But VS2008 wont show the main screen in its XAML designer pane and says that there is an un-handled exception "Object reference not set to an instance of an object." I've seen this error and solved it before but the exception track trace gives no clue as to the source of the exception. Thanks,
Jammer Going where everyone here has gone before! :) My Blog
-
Hi All, Does anyone have any tips on tracking down hard to find problems in XAML? My application runs without any hitches and everything works as designed. Blend opens the solution and displays the main window with out any errors or problems building the solution. But VS2008 wont show the main screen in its XAML designer pane and says that there is an un-handled exception "Object reference not set to an instance of an object." I've seen this error and solved it before but the exception track trace gives no clue as to the source of the exception. Thanks,
Jammer Going where everyone here has gone before! :) My Blog
Jammer, 1. build often so that things don't creep in. 2. I've seen this too. Blend likes this, VS doesn't. Also in the reverse. 3. To find your problem, open in VS and remove sections one at a time until the offending section is discovered. Then, go look at the constructors for code and controls in the offending section. You really need to watch code in your constructors as if it blows up, you get "REAL" misleading exception messages. Hope this helps.
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
-
Jammer, 1. build often so that things don't creep in. 2. I've seen this too. Blend likes this, VS doesn't. Also in the reverse. 3. To find your problem, open in VS and remove sections one at a time until the offending section is discovered. Then, go look at the constructors for code and controls in the offending section. You really need to watch code in your constructors as if it blows up, you get "REAL" misleading exception messages. Hope this helps.
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
Yeah, i builld really often ... in fact almost constantly as I'm still really feeling my way around .NET in general. I have a couple of ideas as to what might be doing it ... I need to investigate these. I think your idea of removing sections (do you mean controls and use controls?) will be a good one ... Do you know of any plans by the WPF team to tighten the grip on XAML exceptions like this? I was chatting to another Developer at work today (a contractor) and he was expressing similar feelings about how difficult it can be to track down XAML problems.
Jammer Going where everyone here has gone before! :) My Blog
-
Yeah, i builld really often ... in fact almost constantly as I'm still really feeling my way around .NET in general. I have a couple of ideas as to what might be doing it ... I need to investigate these. I think your idea of removing sections (do you mean controls and use controls?) will be a good one ... Do you know of any plans by the WPF team to tighten the grip on XAML exceptions like this? I was chatting to another Developer at work today (a contractor) and he was expressing similar feelings about how difficult it can be to track down XAML problems.
Jammer Going where everyone here has gone before! :) My Blog
Jammer wrote:
Do you know of any plans by the WPF team to tighten the grip on XAML exceptions
Have not heard of any specific rumblings, which is why I build often and learn the do's and don'ts. Comes with time, you'll get it all sorted out. :-D
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
-
Hi All, Does anyone have any tips on tracking down hard to find problems in XAML? My application runs without any hitches and everything works as designed. Blend opens the solution and displays the main window with out any errors or problems building the solution. But VS2008 wont show the main screen in its XAML designer pane and says that there is an un-handled exception "Object reference not set to an instance of an object." I've seen this error and solved it before but the exception track trace gives no clue as to the source of the exception. Thanks,
Jammer Going where everyone here has gone before! :) My Blog
Unfortunately, the issue with the designer pane reporting an unhandled exception is consistent with the behaviour of the old WinForms designer. The problem actually relates to the designer having to "compile and interpret" the item in the designer, and some things just go wrong. I usually find that attempting a clean rebuild is a good idea in order to find issues.
Deja View - the feeling that you've seen this post before.
-
Jammer wrote:
Do you know of any plans by the WPF team to tighten the grip on XAML exceptions
Have not heard of any specific rumblings, which is why I build often and learn the do's and don'ts. Comes with time, you'll get it all sorted out. :-D
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
For sure ... nothing beats experience. I have my data loading and saving via my custom dialog now ... all looking very WPF and spanky new sparkly nice ... :) Just trying to find out where the Serialization exceptions live now ...
Jammer Going where everyone here has gone before! :) My Blog
-
Unfortunately, the issue with the designer pane reporting an unhandled exception is consistent with the behaviour of the old WinForms designer. The problem actually relates to the designer having to "compile and interpret" the item in the designer, and some things just go wrong. I usually find that attempting a clean rebuild is a good idea in order to find issues.
Deja View - the feeling that you've seen this post before.
-
Hi Pete, A clean rebuild? Do you mean run a "Clean Solution" and then rebuild/recompile? Cheers,
Jammer Going where everyone here has gone before! :) My Blog
Jammer wrote:
A clean rebuild? Do you mean run a "Clean Solution" and then rebuild/recompile?
I certainly do.
Deja View - the feeling that you've seen this post before.
-
Jammer wrote:
A clean rebuild? Do you mean run a "Clean Solution" and then rebuild/recompile?
I certainly do.
Deja View - the feeling that you've seen this post before.