System.NullReference异常出现在App_Web_XXX.dll - 错误局部图 [英] System.NullReference Exception occurred in App_Web_XXX.dll - Error in Partial View

查看:2755
本文介绍了System.NullReference异常出现在App_Web_XXX.dll - 错误局部图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到这个错误,在DLL名称随机字符串,在我的MVC页面和一个着陆的时候。

I'm getting this error, with a random string in the dll name, when landing on one of my MVC pages.

类型的第一次机会异常的 System.NullReferenceException
  发生在App_Web_cjmhrrqn.dll。
  其他信息:未将对象引用设置到对象的实例

A first chance exception of type System.NullReferenceException occurred in App_Web_cjmhrrqn.dll. Additional information: Object reference not set to an instance of an object.

在另一页上,我打在页面上code的第一线时得到类似的,不管它是什么:

on another page, I get similar when hitting the first line of code on the page, not matter what it is:

类型的第一次机会异常的 System.NullReferenceException 发生在App_Web_register.cshtml.5f83eb8c.gq-8jyy8.dll

A first chance exception of type System.NullReferenceException occurred in App_Web_register.cshtml.5f83eb8c.gq-8jyy8.dll

然而,这是不符合code中的问题。我已经删除失败的线条,并继续以code的下一行失败。我甚至可以把新的code几行,它会在最后一个破发。

However, this is not a problem with the code. I've removed the lines it fails at and it continues to fail at the next line of code. I can even put several lines of new code and it will break at the last one.

这发生在一对夫妇的整个应用程序的地方。

It happens in a couple of places throughout the application.

这也发生在我的Azure部署。

误差不以任何方式发现问题提供帮助。

The error does not help in any way to find the problem.

我怀疑是某种DLL问题,但我已清空了我的垃圾桶,OBJ,和ASP.NET临时文件夹。

My suspicion is some kind of DLL issue but I have cleared out my bin, obj, and ASP.NET temporary folders.

有没有人见过这个问题,或者有什么想法?是否有我需要清除任何其他临时文件夹?或任何其他方式来缓解这一问题?为什么它仍然是我的现场直播也?

Has anyone seen this issue, or have any ideas? Are there any other temporary folders I need to clear? Or any other way to mitigate this issue? How come it is still on my live site too?

推荐答案

确定这样你猜怎么着......这是在code的一个问题。

OK so guess what...it WAS a problem with the code.

的问题是,有一个在局部视图的问题。我试图用Model.SomethingNull不检查它。

The problem was that there was an issue in the Partial view. I was trying to use Model.SomethingNull without checking it.

这个教训在这里了解到,虽然(除了检查空!)是,当有一个局部视图像这样的问题,它使用的是Html.Partial打电话,Visual Studio将无法通过的踩线在局部视图。它只是将无法在部分的开始,也不会告诉你,有问题的地方在里面。

The lesson to be learnt here though (apart from check for null!) is that when there is an issue like this in a partial view which you are calling using Html.Partial, Visual Studio won't step through the lines of the Partial view. It will just fail at the start of the partial and won't tell you that there is a problem somewhere in it.

这也解释了为什么问题是在所有环境present。

This also explains why the problem was present in all environments.

这篇关于System.NullReference异常出现在App_Web_XXX.dll - 错误局部图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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