I am trying to register a dockable window, so I place the following code in the OnStartUp Function:

Imports Autodesk.Revit.ApplicationServices
Imports Autodesk.Revit.Attributes
Imports Autodesk.Revit.DB
Imports Autodesk.Revit.UI
Imports System.Windows.Media.Imaging
Imports System.Windows

Class SomeClassName
Implements IExternalApplication

Public Function OnStartup(ByVal application As UIControlledApplication) As Result Implements IExternalApplication.OnStartup
Try
Dim dPid = New DockablePaneId(New Guid("{12345678-1234-1234-1234-123456789012}"))
If Not DockablePane.PaneIsRegistered(dPid) Then
Dim DPPD As New DockablePaneProviderData
DPPD.FrameworkElement = New WPFPage
DPPD.InitialState = New DockablePaneState() With {.DockPosition = DockPosition.Left}
Dim DPP As IDockablePaneProvider = Nothing
DPP.SetupDockablePane(DPPD)
application.RegisterDockablePane(dPid, "TITLE", DPP)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try

Return Result.Succeeded
End Function

Public Function OnShutdown(ByVal app As UIControlledApplication) As Result Implements IExternalApplication.OnShutdown

Return Result.Succeeded
End Function
End Class

But it gives the following message:

Object reference not set to an instance of an object.

which I think it saying that I have not setup the DockablePaneProvider correctly as the ID and the TITLE seem to be simple.

I have set the initial state and the frameworkelement (to a WPF), so am I missing something simple?

Drew