Visual Studio Intellisense not working on XAML only on very specific circumstances

时光毁灭记忆、已成空白 提交于 2019-11-28 10:58:42

Huh. I just restarted it and it worked again. The problem is that before, when I restarted it, it still did not work. I haven't found the underlying issue, but it's fixed now.

This is one of the most frustrating things about developing wpf apps I have to say. And here is a temporary solution that was observed by chance and works every single time intellisense breaks while working with XAMl:

  • Break the xaml file by any means; ex: removing any char/symbol

  • Hit F6 to build

Done and intellisense is back in couple seconds!

There are several reasons why Intellisense may fail and if you have several factors in play you will have to do several things to get it to work and so I've listed some of the things that I've done to solve this issue in the past.

Make sure you are using either the XAML UI Designer or the Source Code (Text)Editor for editing XAML with Intellisense. The XML (Text) editor does not provide Intellisense on my installation (VS2013 Pro).

If the designer crashes due to an exception in a loaded assembly you may also lose Intellisense. Fix the exception to restore it.

The designer may not load correctly if an assembly in your project is not trusted and has been sandboxed, and this can affect Intellisense.

See the following articles for more information on sandboxing and granting full trust:-

http://msdn.microsoft.com/en-us/library/dd409252(VS.100).aspx

http://msdn.microsoft.com/en-us/library/ee890038(v=vs.110).aspx

Obviously only grant full trust to assemblies that you trust!

To grant full trust to an assembly, browse to the assembly in Windows Explorer and open the file properties and unblock the assembly (see image below).

Also, deleting .suo files can clear intermittent Intellisense problems.

In my case, Tools / Options / Text Editor / XAML / Miscellaneous / Always open documents in full XAML view was Unchecked. After checking it and re-opening my XAML file from Solution Explorer, I had intellisence back.

This happened in Visual Studio 2013.

In my case setting the Properties (F4) > Build Action of the *.XAML to Page fixed IntelliSense.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!