Hello everybody!
In our products, we have a rare NRE while getting ActiveWindow or ActiveDocument through DTE. Typical environment where we see the error is Visual Studio 2013, Windows 7 x64 Professional SP 1.
Full call stack is:
I register the command through 'OleMenuCommandService.AddCommand(myOleMenuCommand)' that gets 'DTE.ActiveWindow' during execution.
How to prevent the error? Maybe, it is not the right place to call 'DTE.ActiveWindow' and I need to wait for something?
In our products, we have a rare NRE while getting ActiveWindow or ActiveDocument through DTE. Typical environment where we see the error is Visual Studio 2013, Windows 7 x64 Professional SP 1.
Full call stack is:
Type: System.NullReferenceException HResult: -2147467261 Stack: at Microsoft.VisualStudio.Platform.WindowManagement.DTE.MainWindow..ctor(WindowBase wrapper, Window window) at Microsoft.VisualStudio.Platform.WindowManagement.DTE.WindowBase.CreateMainWindow() at Microsoft.VisualStudio.Platform.WindowManagement.WindowManagerService.get_MainWindow(Window& mainWindow) at EnvDTE._DTE.get_ActiveWindow()
I register the command through 'OleMenuCommandService.AddCommand(myOleMenuCommand)' that gets 'DTE.ActiveWindow' during execution.
How to prevent the error? Maybe, it is not the right place to call 'DTE.ActiveWindow' and I need to wait for something?