Problems with Visual Studio 2013

SyntaxEditor for Windows Forms Forum

Posted 6 years ago by Mike Dempsey - Sr. Developer, Teradata Corp
Version: 13.1.0310
Avatar

I have a Visual Studio extension that uses a Syntax Editor control.

This works perfectly when running in VS 2010 or 2012 but has major problems when running in VS 2013.

It seems that certain events and triggers simply don't fire.

For example I can display an intellisense list by pressing Ctrl+Space (I override OnSyntaxKeyTyping to manualy display it if the command is Commands.IntelliPromptCompleteWordCommand) but the lists never display automatically - based on the triggers I have defined.

Similarly there are no outlining indicators displayed even though I have defined outlining in the language.

And there is no BraceMatch highlighting.

All the above work fine in the older versions of Visual Studio. (and both the app and the language file are the same)

Finally there are major painting issues... but only after I have changed the TextAreaBackgroundFill of the renderer.
I change it to a pale grey while executing a long running function and then change it back again afterwards.
(I also set ReadOnly true/false for the same period)
It correctly changes the background to pale grey but after I change it back to white the entire background displays as black. Then as I click on different lines the back color of those lines - ONLY - correctly changes to white.
If I then scroll, or adjust the size of the control, the entire background again chages to black.
(While in this state it also fails to remove the old insertion point indicator [vertical bar] when I click on different lines - so Iend up with one flashing insertion point and a bunch of 'solid' ghost insertion points.)

I have found that if I change a color (which calls my function to reset both the renderer colors and the colors used by the language) then the repaint problem goes away until the next time I launch the app.

I am hoping that by describing all the features that don't work it might give you some idea of what is occuring ... and therefore maybe lead me to a workaround of some kind.

Note that creating a 'demo' of the problem might be difficult since it is a VS extension.

Comments (3)

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Mike,

I'm not really sure what would cause those sorts of issues since we haven't heard of them before.  My guess is that in the VS 2013 version, Microsoft altered interop somehow and perhaps that is affecting certain input events?  As for the rendering, that almost sounds like the GDI double buffer is getting corrupted somehow.  The only time we've ever seen black areas is if running out of memory though.  Honestly I'm not sure what we could even do if we had a sample here since it seems like something external to the control is triggering this odd behavior.  Especially when you consider that it worked fine in the previous VS versions and our code (as well as yours?) is identical.

For add-ons of more recent VS versions, I would probably suggest that you use WPF instead of WinForms, since the UI foundation of VS is now in WPF.  That would probably help remove any interop oddities that might be occurring here.


Actipro Software Support

Posted 6 years ago by Mike Dempsey - Sr. Developer, Teradata Corp
Avatar

Yes I think I'm going to have to contact Microsoft on this one.

The app uses the VS2010 SDK (not 2013) as we need it to work in 2010 and 2012 also. That may have something to do with the issue ... in addition to the fact that it makes direct debugging impossible. (You can't reference the 2010 SDK in the 2013 design environment so you have to attach an external debugger)

This extension shares a lot of code with a (large) stand alone app that uses Windows Forms - so switching it to WPF is not really an option.

Answer - Posted 6 years ago by Mike Dempsey - Sr. Developer, Teradata Corp
Avatar

I found the root of the problem.

Microsoft changed the LanguagePreferences class such that it is no longer compatible with previous versions. When you call a function that creates an instance of a LanguagePreferences class the call raises an exception.

I had exception handling INSIDE the function but not around the call to the function, so an outer layer of exception handling caused part of my initialization code to be skipped. This explained the lack of Intellisense etc. It also meant that a variable I used for the background color was uninitialized. The result was that I set the background fill color to Color.Empty - and apparently that causes the renderer to do the strange things I described.

FYI for anyone writing VS extensions.
The workaround is to move the code that references LanguagePreferences to its own function and check what version of VS you are running in. If the version is > 11 just set default values - do not call the function that fetches the LanguagePreferences class.

   

The latest build of this product (v2018.1 build 0341) was released 6 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.