Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

warning VSTHRD010: Accessing "IVsOutputWindowPane" should only be done on the main thread.

$
0
0

I've recently been fixing a bunch of "VSTHRD010" warnings in one of my VS extensions, but I'm stuck on my last one.

I run an external command and echo the output from my "Process" using the Process::OutputDataReceived event. In the handler I provide, I output the string it gives me to a IVsOutputWindowPane using OutputString. It been working fine for ages, but I can see that the thread calling this handler is not surprisingly not the "main" thread, and so I get this compilation warning:-

warning VSTHRD010: Accessing "IVsOutputWindowPane" should only be done on the main thread. Call System.Windows.Threading.Dispatcher.VerifyAccess() first.

How should I go about fixing this warning, or can I safely ignore it for IVsOutputWindowPane::OutputString()? I know about ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync() but not sure if that's useful inside the handler function.

Any help much appreciated as it's making a bit nervous doing something that maybe isn't really supported.


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>