次の方法で共有


Registry Fix for VS 2008 Intellisense Bug

I love my intellisense.  As such, I am very critical when there's a bug affecting its functionality.  The bug I ran into late in the VS 2008 product cycle while doing application-building was, unfortunately, not considered high enough priority to fix so late in the game.  As a result of the investigation, we did find a fix, and I've been using it ever since with no problems.  Here are the details of the problem and how to work around it.

The basic bug is that if you type fast enough, and your CPU is slow or overloaded, you can accidentally bypass the intellisense engine.  This will leave you with unwanted text in the editor.  As an example, when I first saw this bug on my slow Lenova Thinkpad, I was trying to make a Window.Resources tag.  As such, I typed:

<Window.Reso{TAB}

where "{TAB}" was me hitting the tab character to complete the intellisense match.  Much to my dismay, instead of my editor containing "<Window.Resources", it actually contained "<Window.Reso    ", where the tab character had been replaced by spaces in the editor.  To me, this is totally broken!  Do I have to stare at my editor and wait for the intellisense dropdown to appear before I can hit the Tab key?  I type pretty fast... 95 words per minute according to www.TypingTest.com... but I know there are many, many people out there who type (and code) much faster.  And depending on how many apps I was running, or whether Outlook was downloading mail in the background, or whatever, I could reproduce this intellisense failure about 5-10% of the time on my old laptop.

I was in dire need of a workaround. During the investigation, one of our developers found that a simple bit flip in the registry fixes this issue.  Basically, by default, the Orcas XAML intellisense is set to asynchronous behavior.  That means, you can keep typing away, and intellisense will run in a background thread and try to keep up... but if you type too fast or it doesn't get enough CPU time, it doesn't want to block the keystrokes from getting placed in the editor, so it just ignores them.  That's the bug.  The fix is to set the following registry value:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Languages\Language Services\XAML]
"EnableAsyncCompletion"=dword:00000000

Setting this registry value to 0, and restarting VS will make it so your keystrokes never bypass the XAML intellisense engine again.  If you've ever hit this issue, or think you might, you should make this registry change and never look back.

-Bri