C#-StackOverflowException [英] C# - StackOverflowException

查看:88
本文介绍了C#-StackOverflowException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个事件接收器.在此,我添加了一个文件夹&在此范围内,我有1个主类(其中包括大多数方法和代码)和其他2个支持类.主类中的方法已在内部被调用新增项目 事件接收者.工作正常.

今天,我又添加了两个类(例如:GetConfigItem.cs& ProcessConfigItem.cs)&我移动了与&相关的方法从主要类到这两个类的处理项目. &通过创建实例在主类中调用它.现在,当我部署 并添加新项,我将弹出以下异常弹出窗口,

即时调试器在没有必要的安全权限的情况下启动.要调试此过程,必须以管理员身份运行JIT调试器.您要调试过程吗?

如果我附加了流程,那么我将处于低水平,

 System.StackOverflowException:引发了System.StackOverflowException类型的异常

我用Google搜索了&尝试了一些解决方案,但没有运气.

MSDN文章说, StackOverflowException发生在  太 许多嵌套的方法调用. 

请帮助. >  


Vishal M. Patil-MSDN论坛

解决方案

逻辑是否必须属于实例?如果只是辅助类/函数,则可以为此创建一个静态函数,并检查问题是否仍然发生.

最好的问候,

Lee


I have created one event receiver. In this, I have added one folder & within this I have 1 main class (Which include most of the methods & code) & other 2 supporting classes. Method within main class  has been called within  Item added event receiver. Its working fine.

Today i have added two more classes (For eg: GetConfigItem.cs & ProcessConfigItem.cs) & I moved methods related to getting & processing item from main class to this two classes. & called it in main class by creating instance. Now when i deploy and Add new item, I'm getting below exception popup,

The Just-In-Time debugger was launched without necessary security permissions. To debug this proces, the JIT debugger must be run as an administrator. Would you like to debug the proces? 

If I attach process then I'm getting below exeption,

System.StackOverflowException: Exception of type System.StackOverflowException was thrown

I googled & tried some solutions but no luck.

MSDN article says, StackOverflowException occured when there are too many nested method calls. 

Please help.

 

Vishal M. Patil - MSDN Forum

解决方案

Hi,

Does the logic must be belongs to a instance? If it’s just a helper class/function, you could create a static function for this and check whether the issue still happen.

https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/static-classes-and-static-class-members

Best Regards,

Lee


这篇关于C#-StackOverflowException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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