Hello. I have a VSPackage that has a custom editor for non-file based item. This has been working fine in VS2008 and VS2010. I am attempting to upgrade my package to VS2012 and am getting this exception when trying to open the item. The OpenItem code from my UIHierarchy is included below.
System.ArgumentNullException occurred
HResult=-2147467261
Message=Value cannot be null.
Parameter name: o
ParamName=o
Source=mscorlib
StackTrace:
at System.Runtime.InteropServices.Marshal.GetIUnknownForObjectNative(Object o, Boolean onlyInContext)
at Microsoft.VisualStudio.PlatformUI.SafeIUnknown.FromObject(Object o)
InnerException:
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)()
ComUtils.ThrowOnFailure(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))
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