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

[SDK Package] NRE at DTE.ActiveWindow and DTE.ActiveDocument

$
0
0

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:

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?


Viewing all articles
Browse latest Browse all 4410

Trending Articles



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