我该如何解决 ?抛出了System.Invalidoperationexception。 [英] How Do I Fix This ? A System.Invalidoperationexception Was Thrown.

查看:294
本文介绍了我该如何解决 ?抛出了System.Invalidoperationexception。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

抛出了System.InvalidOperationException:表单在构造期间从默认实例引用自身,导致无限递归。在Form的构造函数中,使用'Me'引用表单。 
时间:2015年9月15日下午4:11:59
线程:< no name => [3020]





这部分代码:



 bmpDeck =  DirectCast (formx.vspdeck.GetCurrentVideoFrame()。克隆(),位图)



并且无法加载表单:

< Global.System.Diagnostics.DebuggerStepThroughAttribute()> _ 
受保护的 覆盖 Sub OnCreateMainForm()
Me .MainForm = 全球 .ImageComparison.Formx
结束 Sub

解决方案

< blockquote>错误非常明确:

表单在构造期间从默认实例引用自身,从而导致无限递归。在Form的构造函数中,使用'Me'来引用表单。



从表单构造函数开始,然后开始查找对正在创建的表单实例或新表单实例的引用。在构造函数上放置一个断点并跟进它将是一个好主意。



我们无法为您执行此操作:我们无法访问您的代码!

A System.InvalidOperationException was thrown: "The form referred to itself during construction from a default instance, which led to infinite recursion.  Within the Form's constructor refer to the form using 'Me.'"
Time: 9/15/2015 4:11:59 PM
Thread:<no name="">[3020]



in this part of the code:

bmpDeck = DirectCast(formx.vspdeck.GetCurrentVideoFrame().Clone(), Bitmap)


and cannot load form:

<Global.System.Diagnostics.DebuggerStepThroughAttribute()>  _
     Protected Overrides Sub OnCreateMainForm()
         Me.MainForm = Global.ImageComparison.Formx
     End Sub

解决方案

The error is pretty explicit:

The form referred to itself during construction from a default instance, which led to infinite recursion.  Within the Form's constructor refer to the form using 'Me.'


So start with the form constructor, and start looking for references to form instances or new form instances being created. Putting a breakpoint on the constructor and following it through would be a good idea.

We can't do that for you: we don't have access to your code!


这篇关于我该如何解决 ?抛出了System.Invalidoperationexception。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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