zoukankan      html  css  js  c++  java
  • Asp.Net MVC中递归死循环问题

    在写代码的时候,很欢乐地发现报错了。

    An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll

    具体图示如下:

    后来才发现自己写了一段多余的代码导致其不停循环往复陷入死循环。

    public class ConformanceListRepository
    {
        private readonly ConformanceListService _conformanceListService;
    
        public ConformanceListRepository(ConformanceListService conformanceListService)
        {
            _conformanceListService = conformanceListService;
        }
    }

    这里是在Repository中出了问题。

    所以解决思路是寻找可能出现死循环的地方,通常是像我上面这样,自己调用了自己(_conformanceListService调用ConformanceListRepository,然后循环往复)

  • 相关阅读:
    11.2
    11.1
    10.31JS中级
    10.24
    动画运动
    操作js的样式
    js
    js元素属性
    js轮播
    js计时器
  • 原文地址:https://www.cnblogs.com/chenyangsocool/p/7492956.html
Copyright © 2011-2022 走看看