简体   繁体   English

对象引用未设置为Visual Studio 2013上的对象错误的实例

[英]Object reference not set to an instance of an object error on Visual Studio 2013

I am getting this error pop up box in Visual Studio 2013 Pro version. 我在Visual Studio 2013 Pro版本中收到此错误弹出框。 I get it if i paste something onto a .cshtml page while running the project. 如果我在运行项目时将某些内容粘贴到.cshtml页面上,我就明白了。 Currently I am getting it on an MVC 5 project. 目前我正在使用MVC 5项目。 I am just wondering it is a bug to Visual Studio 2013 or I just messed up my Visual Studio. 我只是想知道它是Visual Studio 2013的一个错误,或者我搞砸了我的Visual Studio。 My VS is genuine version. 我的VS是正版。 I also have 2010, 2012 and 2013 Express installed on my machine. 我的机器上也安装了2010,2012和2013 Express。

UPDATE: 更新:

I found out it happens when I have Razor syntax in the CSS block. 我发现当我在CSS块中使用Razor语法时会发生这种情况。

在此输入图像描述

I had a similar problem. 我遇到了类似的问题。 I just restarted visual studio, and then it worked! 我刚刚重启了visual studio,然后就可以了!

I have the exact same issue. 我有完全相同的问题。 Everything worked well until i used @Url.Content(...) in element in cshtml. 一切都运作良好,直到我在cshtml中的元素中使用@ Url.Content(...)。 Syntax highlighting also disappeared for the whole element (everything is just black). 语法高亮也消失了整个元素(一切都只是黑色)。 Removed the lines with @Url.Content(...) and pasting & syntax highlighting worked again in the moment the last line was removed. 删除带有@ Url.Content(...)的行,并在删除最后一行时再次粘贴和语法突出显示。 Also, when i re-paste one @... line, syntax highlighting stops again, pasting shows the error message. 此外,当我重新粘贴一个@ ...行时,语法突出显示再次停止,粘贴显示错误消息。 Another strange issue: Undo/redo system is stopped. 另一个奇怪的问题:撤消/重做系统已停止。 I don't know if this is because of the error above killed it, but it does not work now (even when no @... things are there). 我不知道这是不是因为上面的错误杀了它,但它现在不起作用(即使没有@ ...东西都存在)。

It might be related to a code editor, which is being used for the current file. 它可能与代码编辑器有关,代码编辑器用于当前文件。 Try right clicking the file in Solution explorer and select Open with and then select the desired code editor. 尝试右键单击解决方案资源管理器中的文件,然后选择打开方式,然后选择所需的代码编辑器。 See if that helps, also you may want to make it default one. 看看是否有帮助,您也可以将其设为默认值。 It helped for me with the same problem but on .cs files. 它对我有同样的问题,但对.cs文件。

This thread is pretty old, but sharing valuable information is always good. 这个帖子很老了,但共享有价值的信息总是好的。 I was facing same issue and solved it accidentally. 我遇到了同样的问题并意外地解决了。

Normally i open project from VS recent projects, but accidentally i opened it via solution file(. sln ) and copy-paste was started working as expected (i realized this after some-time). 通常我从VS最近的项目打开项目,但不小心我通过解决方案文件( .sln )打开它,并且复制粘贴开始按预期工作(我在一段时间后意识到这一点)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在visual studio 2013中打开cshtml文件时,对象引用未设置为对象的实例 - Object reference not set to an instance of an object when opening cshtml files in visual studio 2013 Visual Studio 2017-TFS 2017-“对象引用未设置为对象的实例” - Visual Studio 2017 - TFS 2017 - “Object reference not set to an instance of an object” Visual Studio XAML设计窗口错误:对象引用未设置为对象的实例 - Visual Studio XAML Design Window Error: Object reference not set to an instance of an object 签出另一个分支后出现 Visual Studio git 错误“对象引用未设置到对象的实例” - Visual Studio git error "Object reference not set to an instance of an object" after checking out another branch 安装 ASP.NET 和 Web Tools 2015 后出现 Visual Studio 错误“未将对象引用设置为对象的实例” - Visual Studio error "Object reference not set to an instance of an object" after install of ASP.NET and Web Tools 2015 适用于Visual Studio的Azure流分析工具:执行聚合查询时出错-“对象引用未设置为对象的实例” - Azure Stream Analytics tools for Visual Studio: Error when executing aggregated queries - “Object reference not set to an instance of an object” Visual Studio - 单击解决方案 - >属性时出错(对象引用未设置为对象的实例) - Visual Studio - Error when clicking on Solution -> Properties (Object reference not set to an instance of an object) MySQL for Visual Studio / Visual Studio 2017数据源向导的问题。 你调用的对象是空的 - Issue with MySQL for Visual Studio / Visual Studio 2017 Datasource Wizard. Object reference not set to an instance of an object 使用Visual Studio设计器-“对象引用未设置为对象的实例”(Visual Studio 2008) - Using the Visual Studio designer - “Object reference not set to an instance of an object” (Visual Studio 2008) Visual Studio 中的 SQL Server 单元测试:由于“对象引用未设置到对象的实例”,无法设置测试条件属性。 错误 - SQL Server Unit Test in Visual Studio: Unable to set test condition properties due to "Object reference not set to an instance of an object." error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM