Tagged Questions
77
votes
6answers
30k views
WPF global exception handler
sometimes, under not reproducible circumstances, my WPF application crashes without any message. The application simply close instantly.
Where is the best place to implement the global Try/Catch ...
76
votes
4answers
28k views
Globally catch exceptions in a WPF application?
We are having a WPF application where parts of it may throw exceptions at runtime. I'd like to globally catch any unhandled exception and log them, but otherwise continue program execution as if ...
35
votes
3answers
10k views
A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was
What does this mean and how to resolve it?
I am using TPL tasks.
The whole error
A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a ...
17
votes
4answers
3k views
Why Does WPF Swallow Databinding Exceptions?
I am in the process of learning WPF, and am puzzled by the fact that databinding exceptions do not cause a runtime/unhandled exception.
Can anyone explain the benefits of databinding working in this ...
14
votes
2answers
1k views
Debug and Fixing ObjectDisposedException in Visual Studio 2010
When editing a XAML file I noticed the following error:
System.ObjectDisposedException occurred
Message=Cannot access a disposed object.
Object name: 'FileCodeModel'.
To debug this I ran another ...
13
votes
3answers
4k views
WPF Recursive call to Automation Peer API is not valid
I am receiving an error message "Recursive call to Automation Peer API is not valid" when loading a datagrid with a datatemplatecolumn containing a combobox column. The error ends up caught in our ...
10
votes
2answers
702 views
How can I turn binding errors into runtime exceptions?
Just as there is "treat warning as errors" set in our projects to catch early possible problems, I would love to have a runtime exception to catch them early.
I have recently been bit by this problem ...
10
votes
2answers
4k views
WPF custom error-handling dialog box?
I am trying to set up my WPF application so that when an exception goes unhandled, an error dialog pops up. In good ol' WinForms this was possible by adding
Application.ThreadException += new ...
8
votes
3answers
8k views
Unable to launch onscreen keyboard (osk.exe) from a 32-bit process on Win7 x64
90% of the time I am unable to launch osk.exe from a 32bit process on Win7 x64. Originally the code was just using:
Process.Launch("osk.exe");
Which won't work on x64 because of the directory ...
8
votes
2answers
2k views
“The operation completed successfully” exception
I have a custom method that finds the largest size to use for a given string and font to fill a given box without cutting off the text. To test it, I created a service that cycles through a few ...
7
votes
1answer
4k views
Why Would a Dependency-Property Implementation Crash My Application When I Provide a Default Value?
Why would a dependency-property implementation crash my application when I provide a default value?
This segment of code is in the class declaration for my UserControl object. Everything works fine ...
7
votes
3answers
3k views
WPF DataGrid ItemsSource Binding Issue
I have a DataGrid in a WPF application that binds itself to an ObservableCollection of objects, and everything works fine.
Now if I modify a cell in the datagrid during runtime, and delete the ...
6
votes
2answers
1k views
6
votes
1answer
2k views
What causes an InvalidDeploymentException in a WPF application?
I developed a WPF application and when I launch it in the debug mode I see the following in the output:
'WpfApplication1.vshost.exe' (Managed
(v2.0.50727)): Loaded
...
6
votes
1answer
2k views
Why exceptions are not propagated by WPF Dispatcher.Invoke?
Here's my hypothetical example. I have a very simple WPF window with a one Button. The Button.Click event has a handler that goes like this.
Action doit = () =>
{
Action error = () => { ...