Add code to current editor window in visual studio package/extention?

The problem here is that you are attempting to do an edit on an ITextBuffer from a different thread than the one that owns it. This is simply not possible ITextBuffer instances are affinitized to a particular thread once the first edit occurs and after that point they cannot be edited from a different thread. The TakeThreadOwnership method will also fail after the ITextBuffer has been affinitized.

Most other non-editing methods ( CurrentSnapshot for example) can be called from any thread Typically an ITextBuffer will be affinitized to the Visual Studio UI thread. So to perform the edit use the original SynchronizationContext. Current instance or Dispatcher.

CurrentDispatcher from the UI thread to get back onto the UI thread and then perform the edit.

The problem here is that you are attempting to do an edit on an ITextBuffer from a different thread than the one that owns it. This is simply not possible. ITextBuffer instances are affinitized to a particular thread once the first edit occurs and after that point they cannot be edited from a different thread.

The TakeThreadOwnership method will also fail after the ITextBuffer has been affinitized. Most other non-editing methods (CurrentSnapshot for example) can be called from any thread. Typically an ITextBuffer will be affinitized to the Visual Studio UI thread.So to perform the edit use the original SynchronizationContext.

Current instance or Dispatcher. CurrentDispatcher from the UI thread to get back onto the UI thread and then perform the edit.

Got it! :D Thanks! – Jeremi Stadler Dec 1 '10 at 20:32.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions