Split Window / New Window – Bad Painting Behavior in your Language Service

Recently, a question was asked on the VSX Forum about bad behavior from a language service after the user issues a “split window” or “new window” command. (Fonts are wrong, scroll bars don’t work and are corrupt, etc…) The problem is even present in the RegExLanguageService sample in the Visual Studio 2008 SDK (which is just about the simplest language service one could imagine).

After debugging, it turns out that this is a bug in the sample and not in Visual Studio.

Fortunately, the fix (which you must make in your VS Package and/or installer if you see this behavior) is quite simple. We had failed to add a ProvideLanguageService attribute to the package owning the service (which writes the registry keys at <VSRoot>\Languages\Language Services\<My Language Name>), ultimately causing the strange painting behavior at runtime. Please see Doug’s post in the thread linked above for more details.