poCmd.mpoExtra in EdmCmd_TaskLaunch

Hi.

I'm trying to get the Task add-in samle to work but now I'm stuck on saving which files was selected during the task initiation.

In the examle the Sub OnTaskLaunch looks like this (se below) and I get an error when trying to set inst with poCmd.mpoExtra

The documentation says that "EdmCmd::mpoExtra points to IEdmTaskInstance" @ EdmCmdType.EdmCmd_TaskLaunch

but for me it does not work. What could be wrong? My code is compiled as .Net 4 and everything else in the example works.

Private Sub OnTaskLaunch(ByRef poCmd As EdmCmd, ByRef ppoData As System.Array)

  'Display a message box
where the user types data that is
  '
passed to the task add-in via IEdmTaskInstance::SetValEx
  Dim v11 As IEdmVault11
  v11 = poCmd.mpoVault
  If v11.MsgBox(poCmd.mlParentWnd, "Hello!" + vbLf + "Are you sure you want to launch the test task?", EdmMBoxType.EdmMbt_YesNo) <> EdmMBoxResult.EdmMbr_Yes Then
    poCmd.mbCancel = True
    Exit Sub
  End If

  'Get the property interface used to access the framework
  Dim inst As IEdmTaskInstance

  inst = poCmd.mpoExtra 'Here I get a MsgBox with error "incorrect data"
  inst.SetValEx("MyLaunchVar", "A launch value")

End Sub

while it works fine in Sub OnTaskRun

Private Sub OnTaskRun(ByRef poCmd As EdmCmd, ByRef ppoData As System.Array)


  'Get the property interface used to access the framework
  Dim inst As IEdmTaskInstance

  inst = poCmd.mpoExtra 'Here it's working"

/ Jakob

SolidworksSolidworks Pdm enterprise Pdm