'DispatcherUnhandledException' 找不到?
'DispatcherUnhandledException' could not be found?
我目前有一个关于 DispatcherUnhandledException
的问题。我已经检查过 Google,但似乎没有其他人 have/have 遇到过这个问题。
问题是当我尝试在 App.xaml 中使用 Dispatcher 时 Visual Studio 抛出错误消息。我的代码如下所示:
<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>
我不太明白为什么会导致显示以下错误消息:
Error Unknown member 'DispatcherUnhandledException' on element 'Application' >TaskTree_Universal C:...\TaskTree_Universal\TaskTree_Universal\App.xaml 6
还有这条消息:
Error The property 'DispatcherUnhandledException' was not found in type >'Application'. TaskTree_Universal >C:...\TaskTree_Universal\TaskTree_Universal\App.xaml 6
由于似乎没有其他人可以解决 Dispatcher 根本不存在的问题,如果您提供任何帮助,我将不胜感激。如果需要更多信息才能给出答案,请发表评论,我很乐意分享。
提前致谢。
在 UWP 应用程序中,您将为 WPF 中的 Unhandled
event, instead of the DispatcherUnhandledException
事件添加处理程序:
<Application ...
UnhandledException="Application_UnhandledException"
RequestedTheme="Light">
</Application>
我目前有一个关于 DispatcherUnhandledException
的问题。我已经检查过 Google,但似乎没有其他人 have/have 遇到过这个问题。
问题是当我尝试在 App.xaml 中使用 Dispatcher 时 Visual Studio 抛出错误消息。我的代码如下所示:
<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>
我不太明白为什么会导致显示以下错误消息:
Error Unknown member 'DispatcherUnhandledException' on element 'Application' >TaskTree_Universal C:...\TaskTree_Universal\TaskTree_Universal\App.xaml 6
还有这条消息:
Error The property 'DispatcherUnhandledException' was not found in type >'Application'. TaskTree_Universal >C:...\TaskTree_Universal\TaskTree_Universal\App.xaml 6
由于似乎没有其他人可以解决 Dispatcher 根本不存在的问题,如果您提供任何帮助,我将不胜感激。如果需要更多信息才能给出答案,请发表评论,我很乐意分享。
提前致谢。
在 UWP 应用程序中,您将为 WPF 中的 Unhandled
event, instead of the DispatcherUnhandledException
事件添加处理程序:
<Application ...
UnhandledException="Application_UnhandledException"
RequestedTheme="Light">
</Application>