运行单元测试用例时发生“System.Reflection.TargetInvocationException”

时间:2018-03-15 13:59:01

标签: unit-testing exception

我创建了一个自定义控件,并为该控件维护了近2000个单元测试用例。 每个测试用例中使用的对象都已正确处理。

运行单元测试用例时会出现以下异常。

System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
System.ComponentModel.Win32Exception : A device attached to the system is not functioning
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)


System.ComponentModel.Win32Exception: Error creating window handle.
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)

我无法找出这些例外的根本原因。

0 个答案:

没有答案