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

SDK Package: Visual Studio crushes on retrieving IWpfTextView from IVsEditorAdaptersFactoryService

$
0
0

Hello.

We develop a Visual Studio extension, that opens some documents inside Visual Studio.

First of all, we open a document via IVsUIShellOpenDocument.OpenDocumentViaProjectWithSpecific

Then we retrieve IVsTextView from an opened frame and try to retrieve IWpfTextView from it using IVsEditorAdaptersFactoryService.GetWpfTextView.

Rarely, Visual Studio is unable to process and crushes:

at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at Microsoft.VisualStudio.Editor.Implementation.VsFontsAndColorsInformation.UpdatePlainTextProperties(IClassificationFormatMap classificationFormatMap, IEditorFormatMap editorFormatMap, UInt32 autoForeground, UInt32 autoBackground, IVsColorTable colorTable,
 FONTCOLORPREFERENCES2 fontColorPreferences)
...
at Microsoft.VisualStudio.Editor.Implementation.VsTextViewAdapter.get_WpfTextViewHost()
at Microsoft.VisualStudio.Editor.Implementation.VsEditorAdaptersFactoryService.GetWpfTextViewHost(IVsTextView viewAdapter)

or

at Microsoft.VisualStudio.Editor.Implementation.VsFontsAndColorsInformation.TryGetIndexForNativeItem(String name, IVsColorTable colorTable, Int32& colorTableIndex)
at Microsoft.VisualStudio.Editor.Implementation.VsFontsAndColorsInformation.TryGetItemValue(String itemKey, ResourceDictionary& itemValue, HashSet`1 visitedCategories)
...
at Microsoft.VisualStudio.Editor.Implementation.VsTextViewAdapter.get_WpfTextViewHost()
at Microsoft.VisualStudio.Editor.Implementation.VsEditorAdaptersFactoryService.GetWpfTextViewHost(IVsTextView viewAdapter)
at Microsoft.VisualStudio.Editor.Implementation.VsEditorAdaptersFactoryService.GetWpfTextView(IVsTextView viewAdapter)

Could you suggest me where the problem can be?



Viewing all articles
Browse latest Browse all 4410

Trending Articles



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