简体   繁体   English

VS2013 Intellisense 不断停止工作

[英]VS2013 Intellisense constantly stops working

I have Visual Studio 2013 with no plugins or anything fancy.我有没有插件或任何花哨的东西的 Visual Studio 2013。 Whenever I'm coding, every so often (maybe once every half hour) intellisense randomly stops completing my sentences or popping up at all when I press Ctrl + Space .每当我编码时,当我按Ctrl + Space时,智能感知经常(可能每半小时一次)随机停止完成我的句子或完全弹出。

I have tried Tools->Import and export settings->Reset all settings but it did not help.我试过工具->导入和导出设置->重置所有设置,但没有帮助。 The issue came right back.问题又来了。

The only thing that solves it for me now is to close VS and reopen it.现在唯一为我解决它的是关闭VS并重新打开它。 But as you can imagine, this is extremely frustrating.但是你可以想象,这是非常令人沮丧的。

I was having the same problem and this seemed to work for me.我遇到了同样的问题,这似乎对我有用。

http://omegacoder.com/?p=1008 http://omegacoder.com/?p=1008

Basically, go to Tools >> Options >> Text Editor >> All Languages >> General and make sure that both Auto list members and Parameter information are checked (not the half-checked/square state).基本上,转到工具>>选项>>文本编辑器>>所有语言>>常规并确保检查Auto list membersParameter information (不是半选中/正方形状态)。

This is still happening in VS2013 update 4 (I have a WPF project using C#).这在 VS2013 更新 4 中仍然发生(我有一个使用 C# 的 WPF 项目)。

This was relatively easy to fix by closing then reopening the file not the whole project.通过关闭然后重新打开文件而不是整个项目,这相对容易解决。

Looks like my issue cleared up after deleting the settings folder from my previous VS2010 installation.从我以前的 VS2010 安装中删除设置文件夹后,我的问题似乎解决了。 I followed the instructions here (Also applies to VS2013): http://www.haneycodes.net/visual-studio-2012-intellisense-not-working-solved/我按照这里的说明(也适用于 VS2013): http : //www.haneycodes.net/visual-studio-2012-intellisense-not-working-solved/

In case URL breaks:如果 URL 中断:

  1. Open the start menu and type “%AppData%” and press enter to get to your Application Data Folder.打开开始菜单并输入“%AppData%”并按回车键进入您的应用程序数据文件夹。

  2. Either you were automatically placed in the “Roaming” folder or you weren't.您要么被自动放置在“漫游”文件夹中,要么没有。 If you weren't, go to the “Roaming” folder.如果不是,请转到“漫游”文件夹。

  3. Open the “Microsoft” folder.打开“Microsoft”文件夹。

  4. Open the “VisualStudio” folder.打开“VisualStudio”文件夹。

  5. Here you'll see a folder titled “11.0” (the VS 2012 folder) and probably also “10.0” (the VS 2010 folder).在这里,您将看到一个名为“11.0”(VS 2012 文件夹)的文件夹,可能还有“10.0”(VS 2010 文件夹)。

  6. DELETE (or rename) the “10.0” folder.删除(或重命名)“10.0”文件夹。 Note that you can now kiss your Visual Studio 2010 settings and preferences goodbye (your projects will be safe and sound).请注意,您现在可以告别 Visual Studio 2010 设置和首选项(您的项目将安全无虞)。

  7. DELETE (or rename) all other folders that are not the “11.0” folder, assuming you used to have Visual Studio 2008 or whatever.删除(或重命名)不是“11.0”文件夹的所有其他文件夹,假设您曾经拥有 Visual Studio 2008 或其他任何东西。

Now restart Visual Studio 2012 and you should be good to go!现在重新启动 Visual Studio 2012,您应该一切顺利!

For me, Unloading and Reloading a project fixes MVC cshtml intellisense.对我来说,卸载和重新加载项目修复了 MVC cshtml 智能感知。 Right-click project, click Unload.右键单击项目,单击卸载。 Right click grayed out project, click Reload.右键单击变灰的项目,单击重新加载。

Just to be clear, this problem only happens to me when in C# MVC views, only when checked into TFS.需要明确的是,这个问题只发生在我在 C# MVC 视图中,只有在签入 TFS 时才会发生。

I have also submitted this as a bug to Microsoft, see https://connect.microsoft.com/VisualStudio/feedback/details/932855/vs-2013-c-default-mvc-template-breaks-upon-checkin-to-tfs-2010我也将此作为错误提交给 Microsoft,请参阅https://connect.microsoft.com/VisualStudio/feedback/details/932855/vs-2013-c-default-mvc-template-breaks-upon-checkin-to- tfs-2010

try to delete the .suo file of your solution.尝试删除解决方案的 .suo 文件。 It worked well for me.它对我来说效果很好。

The first thing I should mention is that this hasn't happened since I've upgraded my RAM.我要提到的第一件事是,自从我升级了我的 RAM 后,这还没有发生过。 I was at 4GB when this was happening.发生这种情况时,我的内存为 4GB。 Often had multiple instances open as well as SQL Server.通常打开多个实例以及 SQL Server。

I'm finding this seems to happen when I copy/paste controls on a page.我发现当我在页面上复制/粘贴控件时似乎会发生这种情况。 Another side affect of this is that the designer.(cs/vb/xx) file is not updated right away and I don't have access to those controls in code behind.另一个副作用是designer.(cs/vb/xx) 文件不会立即更新,我无法访问代码隐藏中的这些控件。

I've tried a handful of things and here's a summary of what I've found so far:我已经尝试了一些东西,这里是我迄今为止发现的总结:

  • If only 1 file/window appears to be affected, close/reopen that file.如果似乎只有 1 个文件/窗口受到影响,请关闭/重新打开该文件。

If that doesn't work... in Visual Studio:如果这不起作用...在 Visual Studio 中:

  1. Click Tools->Options->Text Editor->All Languages->General单击工具->选项->文本编辑器->所有语言->常规
  2. Uncheck "Auto list members"取消选中“自动列出成员”
  3. Uncheck "Parameter information"取消选中“参数信息”
  4. Check "Auto list members" (yes, the one you just unchecked)选中“自动列出成员”(是的,您刚刚取消选中的那个)
  5. Check "Parameter information" (again, the one you just unchecked)检查“参数信息”(再次,您刚刚取消选中的那个)
  6. Click OK单击确定

If this doesn't work, here's a few more steps to try:如果这不起作用,请尝试以下几个步骤:

  1. If still not working, close all windows and reopen如果仍然无法正常工作,请关闭所有窗口并重新打开
  2. If still not working, close/reopen solution如果仍然不起作用,请关闭/重新打开解决方案
  3. If still not working, restart VS.如果仍然无法正常工作,请重新启动 VS。

(I haven't yet figured out why more drastic steps are required in some cases.) (我还没有弄清楚为什么在某些情况下需要更严厉的步骤。)

For C++ projects:对于 C++ 项目:
MSDN has a few things to try: MSDN suggestions MSDN 有几件事可以尝试: MSDN 建议

The corrupt .ncb file seems most likely.损坏的.ncb文件似乎最有可能。 Note that in VS2013 and later, it is the .sdf file, which can be found in the root folder.请注意,在 VS2013 及更高版本中,它是.sdf文件,可以在根文件夹中找到。 Try searching for filename:*.sdf .尝试搜索filename:*.sdf

From MSDN:来自 MSDN:

  1. Close the solution.关闭解决方案。
  2. Delete the .ncb file.删除.ncb文件。
  3. Reopen the solution.重新打开解决方案。 (This creates a new .ncb file.) (这会创建一个新的.ncb文件。)

Notes:笔记:

  • Tested in VS 2013/2015在 VS 2013/2015 中测试

Logging possible causes:记录可能的原因:

  • Copy/pasting controls in a source page.在源页面中复制/粘贴控件。 I found that my designer.vb file didn't update from this, either.我发现我的designer.vb文件也没有从此更新。
  • Copy/pasting code from another page that caused an error because the code copied referred to a control that wasn't on the page I was pasting to.从另一个页面复制/粘贴代码导致错误,因为复制的代码引用了不在我粘贴到的页面上的控件。
  • C++ project has corrupt .ncb file C++ 项目已损坏.ncb文件

Like cacau says, you must first do a clean of the entire solution.就像 cacau 所说的,您必须首先清理整个解决方案。 Then restart VS rebuild the entire solution.然后重启VS重建整个解决方案。 This sometimes happens when you are using Entity Framework or WCF services (Or the combination)当您使用实体框架或 WCF 服务(或组合)时,有时会发生这种情况

VS generates a lot of files then that contain code (the service reference for example). VS 会生成很多包含代码的文件(例如服务引用)。 When you regenerate that code (And for example you are running a web project) sometimes you forget to stop the site.当您重新生成该代码时(例如您正在运行一个 Web 项目),有时您会忘记停止该站点。 Then VS can't overwrite every file.那么VS不能覆盖每个文件。 Resulting in a global intellisense failure.导致全球智能感知失败。

For me, the problem happens when I have two instances of same solution opened.对我来说,当我打开两个相同解决方案的实例时会出现问题。 On one of them I'm running Tests, while on the other I am making tweaks to code.其中一个我正在运行测试,而另一个我正在对代码进行调整。 Intellisense will quit working on me usually after I've run some tests and stopped the debug session manually. Intellisense 通常会在我运行一些测试并手动停止调试会话后停止对我的工作。

The solution for me is to close all VS windows and reopen...我的解决方案是关闭所有 VS 窗口并重新打开...

Did you try a clean build on your project?您是否尝试过对项目进行干净的构建?

VS might have become confused with some of its generated files.. VS 可能已经与它生成的一些文件混淆了。

None of the solutions in this thread worked for me.该线程中的所有解决方案都不适合我。 what worked was that I deleted everything in the packages folder.有效的是我删除了包文件夹中的所有内容。 when I rebuilt the solution, nuget got the latest versions of all the folders I deleted, and intellisense started working fine.当我重建解决方案时,nuget 获得了我删除的所有文件夹的最新版本,并且智能感知开始正常工作。 If I am not mistaken, the problem initially was caused by the contents of the "Microsoft.Net.Compilers.1.0.0" folder, but I dont know why.如果我没记错的话,问题最初是由“Microsoft.Net.Compilers.1.0.0”文件夹的内容引起的,但我不知道为什么。

If you have this problem in one file, make sure that this file is included in your project.如果您在一个文件中遇到此问题,请确保该文件包含在您的项目中。 Right Click the file, Select Include In Project .右键单击该文件,选择 Include In Project If the file is not included in your project, VS will treat it as a normal text file.如果该文件未包含在您的项目中,VS 会将其视为普通文本文件。

I followed the instructions given in response to the question : Visual Studio 2012 - Intellisense sometimes disappearing / broken (thanks to SajjadHashmi and others).我按照针对以下问题给出的说明进行操作: Visual Studio 2012 - Intellisense 有时会消失/损坏(感谢 SajjadHashmi 和其他人)。 I've copied the steps I followed (which worked for me) here in an attempt to be helpful.我在这里复制了我遵循的步骤(对我有用),以期提供帮助。

1: Close all the tabs and open your file again. 1: Close all the tabs并再次打开您的文件。 (Thanks to russds) (感谢 russds)

2: Clean the Build > Close the Solution > Restart Visual Studio > Open the Solution again 2: Clean the Build > Close the Solution > Restart Visual Studio >再次Open the Solution

Further steps are listed if you follow the above link but some seem to no longer apply to Visual Studio 2013 (eg refresh Local Cache for intellisense).如果您按照上面的链接列出了进一步的步骤,但有些步骤似乎不再适用于 Visual Studio 2013(例如刷新智能感知的本地缓存)。

I know that these steps involve restarted Visual Studio (which you are explicitly trying to avoid) but for those who find your question (such as me) a potential solution might be useful.我知道这些步骤涉及重新启动的 Visual Studio(您明确地试图避免),但对于那些发现您的问题(例如我)的人来说,潜在的解决方案可能会有用。

In case anyone else fell into the black hole I did ... I too suffered from this issue but NONE of the above solutions worked for me.万一其他人掉进了我的黑洞……我也遇到了这个问题,但上述解决方案都不适合我。 Eventually I figured out that somehow the opening <body> tag had been deleted from my .Master page and that was causing all my .aspx pages to lose 95% of the Intellisense code hinting.最终我发现以某种方式开头的 <body> 标记已从我的 .Master 页面中删除,这导致我所有的 .aspx 页面丢失了 95% 的 Intellisense 代码提示。 Once I added the missing <body> back to my .Master page, the Intellisense finally started working in my .aspx pages again!一旦我将丢失的 <body> 添加回我的 .Master 页面,Intellisense 终于再次开始在我的 .aspx 页面中工作! Hope this helps someone ... just cost me 1.5 hours!希望这可以帮助某人......只花了我 1.5 小时!

Sometimes none of suggestions here works - at least that happened to me.有时这里的任何建议都不起作用 - 至少发生在我身上。 But don't rush with configuration resetting, cleaning up visual studio configuration files and so on.但是不要急于进行配置重置、清理 Visual Studio 配置文件等。 If clean/re-build + vs restart does not work - problem might be in code itself.如果清理/重新构建 + vs 重启不起作用 - 问题可能出在代码本身。

In my case (vs2013) I had C++ class exposed in .h like this:就我而言(vs2013),我在 .h 中暴露了 C++ 类,如下所示:

class MyClass: ...
{
    ....
    DLL_EXPORT returnArgs function(InParameters)
}

where DLL_EXPORT is defined as :其中 DLL_EXPORT 定义为:

#define DLL_EXPORT __declspec(dllexport)

Same function in .cpp: .cpp 中的相同功能:

returnArgs MyClass::function(InParameters)
{

}

vs2013 was refusing to jump between function definition / implementation. vs2013 拒绝在函数定义/实现之间跳转。 Reason seemed to be DLL_EXPORT macro - I've written function like this:原因似乎是 DLL_EXPORT 宏——我写了这样的函数:

DLL_EXPORT returnArgs MyClass::function(InParameters)
{

}

After that intellisense started to work again.在那之后,智能感知再次开始工作。

It's possible also to remove that define or wipe it out - according to visual studio documentation __INTELLISENSE__ - but that define did not work for me for some reason.根据 Visual Studio 文档__INTELLISENSE__ ,也可以删除该定义或将其__INTELLISENSE__ - 但由于某种原因,该定义对我不起作用。 Code snipet like this:像这样的代码片段:

#ifdef __INTELLISENSE__
    #define DLL_EXPORT
#else
    #define DLL_EXPORT __declspec(dllexport)
#endif

Please comment if you understand why this does not work.如果您明白为什么这不起作用,请发表评论。

In vs2015 this issue seems to be fixed, but there are other problems with vs2015.在 vs2015 中,这个问题似乎已修复,但 vs2015 还存在其他问题。

None of these things worked for me.这些东西都不适合我。 After lot of struggle I found why it was not working for me.经过很多努力,我发现了为什么它对我不起作用。 I always had multiple solutions open in my machine.我总是在我的机器上打开多个解决方案。 For suppose, One solution is for front-end layer and another solution is for back-end layer.假设,一种解决方案是前端层,另一种解决方案是后端层。

When it hits breakpoint kept in backend service layer intellisense was not showing up.当它击中保持在后端服务层中的断点时,智能感知没有出现。 After I closed all other solutions and rebuild the solution where I wanted to debug, everything worked fine.在我关闭所有其他解决方案并重建我想要调试的解决方案后,一切正常。

There could be other reasons, but this worked for me and wanted to let this community know and it may help someone.可能还有其他原因,但这对我有用,并且想让这个社区知道,这可能会对某人有所帮助。

EDIT: Few times "delete all breakpoints" and adding again worked.编辑:几次“删除所有断点”并再次添加工作。

I had the same problem and in my case it was the same file being open twice.我遇到了同样的问题,就我而言,它是同一个文件被打开两次。 For example I have dev\\include\\myfile.h AND dev\\include\\myfile.h\\ (note the backslash, making this a unique string).例如,我有 dev\\include\\myfile.h 和 dev\\include\\myfile.h\\(注意反斜杠,使其成为唯一的字符串)。 This happens when I use F12 to find a symbol in an include file, but also have the original .h file open already;当我使用 F12 在包含文件中查找符号时会发生这种情况,但原始 .h 文件已经打开; Visual Studio opens up a duplicate file, which is really the same file. Visual Studio 打开一个重复的文件,它实际上是同一个文件。

When saving either of the two instances, the changed file date will be noticed and I get a popup asking whether I want to reload the other instance.保存两个实例中的任何一个时,将注意到更改的文件日期,并且我会收到一个弹出窗口,询问我是否要重新加载另一个实例。 More problematic seems that it also confuses IntelliSense.更成问题的似乎是它也混淆了 IntelliSense。 I just tried closing all duplicate instanced files, and IntelliSense started working again without restarting or reloading anything.我只是尝试关闭所有重复的实例化文件,并且 IntelliSense 重新开始工作,而无需重新启动或重新加载任何内容。

I tried to fix my problem by solution VS2013 Intellisense constantly stops working我试图通过解决方案解决我的问题VS2013 Intellisense 不断停止工作

But it did not work for me.但它对我不起作用。

Solution that worked for me is off/on Auto list members对我有用的解决方案是关闭/打开自动列表成员

Go to Tools > Options > Text Editor > General转到工具 > 选项 > 文本编辑器 > 常规

在此处输入图片说明

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM