0

我们最近在生产环境中放置了一个 MVC 应用程序,它有时会给我们带来无法在开发环境中重现的未处理错误。Web 应用程序不断在同一行崩溃,但内部异常给出不同的错误消息。它崩溃的那一行是在访问特定属性时(属性访问器)。但是内部异常给了我们以下不同的错误:

无法将“System.Int32”类型的对象转换为“System.String”类型。

指数数组的边界之外。

已经有一个与此命令关联的打开的 DataReader,必须先关闭它。

我们有大量用户,所以我假设这与并发或某种类型的线程问题有关?有人可以指导我如何找到问题的正确方向吗?

顺便说一句,访问相同的属性时它总是崩溃。有时它会起作用,有时它会失败。

这是访问器的代码:

public string DepartementSelectionne
    {
        get
        {
            if (string.IsNullOrEmpty(m_departementSelectionne) == true)
                if (ListeDepartements.FirstOrDefault() != null)
                    m_departementSelectionne = ListeDepartements.First().CodeDepartement;

            return m_departementSelectionne;
        }
        set
        {
            m_departementSelectionne = value;
        }
    }

谢谢!

4

0 回答 0