In my VSIX project this error is shown on the line:
(AdapterService as IVsEditorAdaptersFactoryService).SetDataBuffer(textLines, projBuffer as IProjectionBuffer);
where textLines
is created using CreateInstance
method of my package
Type textLinesType = typeof(IVsTextLines);
Guid riid = textLinesType.GUID;
Guid clsid = typeof(VsTextBufferClass).GUID;
IVsTextLines textLines = (_package as Package).CreateInstance(ref clsid, ref riid, textLinesType) as IVsTextLines;
What actually is DocumentTextBuffer
property and how do I set it on a newly instantiated IVsTextLines
?
What I am trying to do is create a IVsTextLines
to pass it as a buffer to IVsCodeWindow
.
I changed the initialization of textLines
to
textLines = AdapterService.CreateVsTextBufferAdapter(serviceProvider as IOleServiceProvider,
(contentTypeRegistry as IContentTypeRegistryService).GetContentType("csharp")) as IVsTextLines;
and then have used the IVsTextBuffer.InitializeContent method to initialize the Document and Data text buffer to a single space character. After that I was able to successfully use the SetBuffer
method.
I am still haven't finalized my extension, so I am not sure how relevant Document Buffer's content is.