“System.Reflection.TargetInvocationException”发生在presentationFramework.dll [英] 'System.Reflection.TargetInvocationException' occurred in PresentationFramework.dll

查看:188
本文介绍了“System.Reflection.TargetInvocationException”发生在presentationFramework.dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好了,我都有点怪异的bug ......

Okay, I have a bit of a weird bug...

这工作得很好:

private void radioButtonNormalPoint_Checked(object sender, RoutedEventArgs e)
{
   //comboBoxNormalPoint.SelectedIndex = 0;
   //ellipsePoint.Fill = System.Windows.Media.Brushes.Black;
}

这抛出 System.Reflection.TargetInvocationException

private void radioButtonNormalPoint_Checked(object sender, RoutedEventArgs e)
{
   comboBoxNormalPoint.SelectedIndex = 0;
   ellipsePoint.Fill = System.Windows.Media.Brushes.Black;
}

此外,它不会让我调试它,它崩溃的程序加载,如果我把一个断点任何地方它不打它,它只是错误的时候了。

Also, it doesn't let me debug it, it crashes as the program loads, if i put a breakpoint anywhere it doesn't hit it, it just errors right away.

推荐答案

该事件可能引发之前的元素都满载或引用未设置还在,因此例外。尝试仅仅设置属性,如果引用不是 IsLoaded

The event is probably raised before the elements are fully loaded or the references are still unset, hence the exceptions. Try only setting properties if the reference is not null and IsLoaded is true.

这篇关于“System.Reflection.TargetInvocationException”发生在presentationFramework.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆