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

COMException calling OpenSpecificEditor

$
0
0

Hello.  I have a VSPackage that has a custom editor for non-file base item.  This has been working fine in VS2008 and VS2010.  I am attempting to upgrade my package to VS2012 and am getting an error result when trying to open the item.  The OpenItem code from my UIHierarch is included below.  I had another exception from this same location the other day, which was resolved in this post:

http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/9829e5d5-8a80-47b0-93d1-d64db835108a

Because this is a result code instead of a managed exception, I'm not sure how to get a call stack.

System.Runtime.InteropServices.COMException (0x800706F4): A null reference pointer was passed to the stub. (Exception from HRESULT: 0x800706F4)

   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)

   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)

   at NucorBuildingSystems.CodeReviewTools.ComUtils.ThrowOnFailure(Int32 result, Int32[] expectedHRFailure) in C:\Nucor Project Files\Developer Tools\Main\TFSTools\CodeReviewTools\CodeReviewTools\Package Plumbing\NativeMethods.vb:line 38

   at NucorBuildingSystems.CodeReviewTools.ComUtils.ThrowOnFailure(Int32 result) in C:\Nucor Project Files\Developer Tools\Main\TFSTools\CodeReviewTools\CodeReviewTools\Package Plumbing\NativeMethods.vb:line 34

   at NucorBuildingSystems.CodeReviewTools.CodeReviewUIHierarchy.OpenItem(UInt32 itemid, Guid& rguidLogicalView, IntPtr punkDocDataExisting, IVsWindowFrame& ppWindowFrame) in C:\Nucor Project Files\Developer Tools\Main\TFSTools\CodeReviewTools\CodeReviewTools\Package Plumbing\CodeReviewUIHierarchy.vb:line 211

   at NucorBuildingSystems.CodeReviewTools.CodeReviewToolsPackage.ShowCodeReviewEditor(Nullable`1 reviewid, ParticipantsRow initialparticipant, List`1 initialartifacts, String serveritem) in C:\Nucor Project Files\Developer Tools\Main\TFSTools\CodeReviewTools\CodeReviewTools\Package Plumbing\CodeReviewToolsPackage.vb:line 623

    Public Function OpenItem(ByVal itemid As UInteger, ByRef rguidLogicalView As System.Guid, ByVal punkDocDataExisting As System.IntPtr, _
                             ByRef ppWindowFrame As Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame) As Integer Implements Microsoft.VisualStudio.Shell.Interop.IVsProject.OpenItem
        Debug.WriteLine("OpenItem")
        ppWindowFrame = Nothing
        If _nodesbyid.ContainsKey(itemid) Then
            Dim node = _nodesbyid(itemid)
            ' show the document, set ppWindowFrame
            CodeReviewToolsPackage.Instance.WaitCursor()
            Dim frame As IVsWindowFrame = GetDocumentWindowFrame(node)
            If (frame Is Nothing) Then
                Dim empty As Guid = Guid.Empty
                Dim flags As UInteger = (__VSOSEFLAGS.OSE_UseOpenWithDialog Or _VSRDTFLAGS.RDT_DontAddToMRU)  ' &H10010048
                Dim opendocument As IVsUIShellOpenDocument = CodeReviewToolsPackage.Instance.GetService(Of SVsUIShellOpenDocument, IVsUIShellOpenDocument)()

                Dim result = opendocument.OpenSpecificEditor(flags, node.CanonicalName, _
                    node.EditorGuid, Nothing, empty, node.Caption, DirectCast(Me, IVsUIHierarchy), node.ItemId, _
                    punkDocDataExisting, DirectCast(CodeReviewToolsPackage.Instance, Microsoft.VisualStudio.OLE.Interop.IServiceProvider), frame)
                ComUtils.ThrowOnFailure(result)


                Dim docview As ICodeReviewToolsEditor
                ComUtils.ThrowOnFailure(frame.GetProperty(__VSFPROPID.VSFPROPID_DocView, docview))
                docview.WindowFrame = frame
                frame.Show()
                ppWindowFrame = frame
            Else
                frame.Hide() ' Make sure the activated event is thrown when we .Show()
                frame.Show()
                ppWindowFrame = frame
            End If

            Return VSConstants.S_OK
        Else
            Return VSConstants.E_FAIL
        End If
    End Function


Viewing all articles
Browse latest Browse all 4410

Trending Articles



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