Search code examples
.netvisual-studio-2010sdkvisual-studio-sdk

IVsEditorAdaptersFactoryService.CreateVsTextViewAdapter throws an object null reference


I'm trying to create a IVsTextViewAdpater with the IVsEditorAdaptersFactoryService but when I call CreateVsTextViewAdapter it throws an object null reference:

    var editorFactory = componentModel.GetService<IVsEditorAdaptersFactoryService>();
    var serviceProvider = (Microsoft.VisualStudio.OLE.Interop.IServiceProvider)this;
    var view = editorFactory.CreateVsTextViewAdapter(serviceProvider);

'this' is a Microsoft.VisualStudio.Shell.Package implementation.

Any ideas?


Solution

  • See this post