gpt4 book ai didi

WPF 表示框架异常 :(

转载 作者:行者123 更新时间:2023-12-04 14:05:11 27 4
gpt4 key购买 nike

所以我正在为我的暑期类(class)做最后一个项目,我得到了以下异常(exception)。

PresentationFramework.dll 中发生类型为“System.Reflection.TargetInvocationException”的未处理异常

查看调用堆栈,它进行了所有的预处理,并且它发生了。它甚至没有启动我的应用程序,所以我不认为它可能是我的代码。我有可能不小心删除了一些文件吗?我的项目运行良好。我做了一些更改,其中一个是添加对我将要使用的类的引用,但后来改变了主意。我删除了它,做了一些更改,然后去运行它,砰!是的,版本控制可能使我摆脱了这个问题,菜鸟错误!

任何帮助表示赞赏!

编辑:实际上似乎有几个异常(exception),这是输出窗口的一部分

A first chance exception of type 'System.NullReferenceException' occurred in StockAnalysis.exe A first chance exception of type 'System.NullReferenceException' occurred in System.Xaml.dll A first chance exception of type 'System.NullReferenceException' occurred in PresentationFramework.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in System.Xaml.dll A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in PresentationFramework.dll An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in PresentationFramework.dll

Additional information: Exception has been thrown by the target of an invocation.

最佳答案

TargetInvocationException几乎总是有 InnerException设置为某事。尝试在 Visual Studio 中运行它,以便出现异常对话框,单击“查看详细信息”链接,您将能够展开异常的属性以找出真正发生的情况。

在 100% 的情况下,我都收到了 TargetInvocationException ,其 InnerException不为空。大多数情况下(取决于您的异常处理),只有 1 InnerException .

记住一条很好的规则:始终检查 InnerException .

关于WPF 表示框架异常 :(,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6881047/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com