Visual studio 2015 DTE2.VSIX CommandPackage中的文档异常
我试着做:Visual studio 2015 DTE2.VSIX CommandPackage中的文档异常,visual-studio-2015,vsix,Visual Studio 2015,Vsix,我试着做: Private _applicationObject As EnvDTE80.DTE2 = DirectCast(Me.ServiceProvider.GetService(GetType(SDTE)), DTE2) Dim docs As EnvDTE.Documents = _applicationObject.Documents Dim doc As EnvDTE.Document For Each doc In docs 'foobar() Next
Private _applicationObject As EnvDTE80.DTE2 = DirectCast(Me.ServiceProvider.GetService(GetType(SDTE)), DTE2)
Dim docs As EnvDTE.Documents = _applicationObject.Documents
Dim doc As EnvDTE.Document
For Each doc In docs
'foobar()
Next
但是在“文档”的第4行中有一个未知的COM异常。调用类的头/扩展名:
<PackageRegistration(UseManagedResourcesOnly:=True)>
<InstalledProductRegistration("#3110", "#3112", "1.0", IconResourceID:=3400)>
<ProvideMenuResource("Menus.ctmenu", 1)>
<Guid(Command1Package.PackageGuidString)>
<ProvideAutoLoad(UIContextGuids80.SolutionExists)>
Public NotInheritable Class Command1Package
Inherits Package
System.Runtime.InteropServices.COMException ist aufgetreten.
ErrorCode=-2147467259
HResult=-2147467259
Message=Unbekannter Fehler (Ausnahme von HRESULT: 0x80004005 (E_FAIL))
Source=""
StackTrace:
bei System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
bei Microsoft.VisualStudio.Shell.Design.Serialization.DesignerDocDataService.Microsoft.VisualStudio.Shell.Interop.IVsRunningDocTableEvents.OnBeforeLastDocumentUnlock(UInt32 docCookie, UInt32 lockType, UInt32 readLocksRemaining, UInt32 editLocksRemaining)
bei EnvDTE.Documents.GetEnumerator()
bei TabContextMenuExt.Command1.CloseAllWorkingDocuments() in C:\_demos\jur\TabContextMenuExt\Command1.vb:Zeile 84.
InnerException: