Light Drake
Light Drake

Reputation: 121

'DispatcherUnhandledException' could not be found?

I am currently having an issue concerning the DispatcherUnhandledException. I have checked with Google, but nobody else seems to have/have had this problem.

The issue is that Visual Studio throws error messages when I try to use the Dispatcher in App.xaml. My code looks like this:

<Application
    x:Class="TaskTree_Universal.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:TaskTree_Universal"
    DispatcherUnhandledException="App_DispatcherUnhandledException"
    <!--The above line causes the problem-->
    RequestedTheme="Light">
</Application>

I do not quite understand why this causes the following error message to show:

Error Unknown member 'DispatcherUnhandledException' on element 'Application' >TaskTree_Universal C:...\TaskTree_Universal\TaskTree_Universal\App.xaml 6

And this message as well:

Error The property 'DispatcherUnhandledException' was not found in type >'Application'. TaskTree_Universal >C:...\TaskTree_Universal\TaskTree_Universal\App.xaml 6

Since nobody else seems to have a solution to the problem of the Dispatcher simply not existing, I would be thankful for any help you have to offer. If any more information is neceassary to give an answer, then comment and I would be happy to share.

Thank you in advance.

Upvotes: 1

Views: 380

Answers (1)

Clemens
Clemens

Reputation: 128060

In a UWP app you would add a handler for the Unhandled event, instead of the DispatcherUnhandledException event in WPF:

<Application ...
    UnhandledException="Application_UnhandledException"
    RequestedTheme="Light">
</Application>

Upvotes: 1

Related Questions