-2

I'm trying to get WPF databinding errors to display in the Output window. None of the suggestions found here have helped, nor here.

Is there anything else I might try?

12
  • What exactly do you mean? The default behaviour outputs errors for failed bindings. Commented Jul 10, 2020 at 17:08
  • That's what I'm to understand. For some reason, however, it's not doing that for me. It was a comment in this Q&A that brought it to my attention that we were even supposed to see it at all. Commented Jul 10, 2020 at 18:49
  • Tell us more about your app. In a totally new solution. Add a textbox and a binding for it's text property to foo. Hit f5. No databinding failure in the output window? Commented Jul 11, 2020 at 11:01
  • Tell us more about your app It's pretty simple so far. You can see it here. Add a textbox and a binding ... to foo Done. Brand new solution. Same result. Not a peep. Commented Jul 11, 2020 at 14:28
  • This is visual studio then. Seems you've somehow got first chance exceptions entirely switched off. You could try resetting to default. I think the comand line switches listed here still apply. stackoverflow.com/questions/17203820/… Commented Jul 11, 2020 at 15:02

2 Answers 2

1
+100

Your problem seems to be caused by your settings.

Which is why I suggested you return your install to default settings. Since you don't want to do that then it's a case of working out which part you changed to stop this working.

These are first chance exceptions you're not seeing. And, obviously, they are wpf binding specifically.

There are a number of ways someone could break this functionality.

There is an option you can set in code. This would be in app.xaml.cs or mainwindow ctor. Seeing as this happens in a brand new clean solution then I should think this is unlikely unless you're somehow getting this in there:

 System.Diagnostics.PresentationTraceSources.DataBindingSource.Switch.Level = 
System.Diagnostics.SourceLevels.Critical;

That'd simply filter out all databinding failures.

There's also Tools > Options > Debugging > Output Window

In there you will see the settings for the output window. It ought to look like:

WPF Trace settings

You can also set options on the output window itself. Right click it and on the context menu there are a bunch of checkable options. Top of which is Exception Messages. If that isn't ticked then tick it. This particular checkbox will send first chance exceptions to the immediate window if unchecked.

see https://learn.microsoft.com/en-us/visualstudio/ide/reference/immediate-window?view=vs-2019#first-chance-exception-notifications

First-chance exception notifications

In some settings configurations, first-chance exception notifications are displayed in the Immediate window.

Toggle first-chance exception notifications in the Immediate window On the View menu, click Other Windows, and click Output.

Right-click on the text area of the Output window, and then select or deselect Exception Messages.

There is also an outside chance you've got a plug in or something which is interfering. For example, the preview xaml binding failures plugin.

If all else fails you might want to try that.

https://marketplace.visualstudio.com/items?itemName=PeterSpa.XamlBinding

This is still experimental, but if your install is somehow subtly broken then you're not going to get any worse than totally missing binding failures.

Sign up to request clarification or add additional context in comments.

5 Comments

I tried everything: 1) Startup switches 2) Deleted registry keys 3) Deleted %LocalAppData% folders 4) Snoop [see my comment in the other answer] 5) Marketplace extension 6) Exception settings 7) Output window options 8) Adjusting my tongue in my cheek 9) Standing on my head. Nothing helped. Then, by an absolute fluke, I happened to notice that binding errors are being sent to the Immediate window, not Output. I have no way of knowing whether this was happening before I tore the guts out of my setup.
You went to a lot of trouble to accommodate my persnicketiness and composed a damn fine answer. I believe that calls for a bonus award.
Thanks for the edit. I tried that just now—had tried it earlier as well—but still no luck. Binding errors are still going to the Immediate Window. But that's OK with me if it's OK with you. At least I can see 'em. I can live with that.
You closed vs down and re-opened after the change? It's dis-satisfying not having an absolute fix but this works for me so you have something else interfering. I suppose it's an advantage in a way. Assuming you don't use the immediate window so much then having the errors appear there makes them easier to find.
Actually, there was no change. Exceptions were already selected. Good point on the advantage—I was thinking pretty much the same thing. If I start to get quirky behavior in my app that hints at a binding error, I can just go to the IW. Thanks again.
0

If your objective is to view the databinding errors only for debugging purposes, and you are having trouble with setting it up, I would suggest use of an alternate tool: The Snoop tool. Very useful tool with a small learning curve. It is extremely useful for other situations as well.

Wpf Snoop

Usage to view binding errors

1 Comment

Oddly, nothing shows up in Snoop either. But don't we have to catch the exceptions as they occur? By the time we attach Snoop, those exceptions are long gone. Here's my XAML and the problem I'm trying to troubleshoot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.