“System.Reflection.TargetInvocationException”发生在presentationFramework.dll发生在、Reflection、System、Targe

由网友(男神在韩国)分享简介:好了,我都有点怪异的bug ...... Okay, I have a bit of a weird bug...这工作得很好:private void radioButtonNormalPoint_Checked(object sender, RoutedEventArgs e){//comboBoxNorm...

好了,我都有点怪异的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.

阅读全文

相关推荐

最新文章