![](/img/trans.png)
[英]An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll error occurred?
[英]An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll
我在asp.net中编写了一个代码,用于从文件中读取数据并绘制图形。
它工作但是在我运行程序一段时间后,出现了这个异常
“mscorlib.dll中发生了'System.StackOverflowException'类型的未处理异常”
在代码中的这个语句中:
if (File.Exists(fName)) <----(here is the exception)
{
stream = File.Open(fName, FileMode.Open);
g_day = Deserialize(stream);
stream.Close();
int cn = 0;
if (g_day.Values.Count != 0)
cn = g_day.Values[g_day.Values.Count - 1].Value;
Label1.Text = cn.ToString();
}
你的函数可能是无限次地递归调用自身。 有时候这是间接发生的(你在BCL中调用一个方法,它会回调你的代码,这会不断重复)。 File.Exists可能不是罪魁祸首。 发生错误时查看调用堆栈。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.