EdmCmd_TaskLaunch not running

I cannot find what I’m doing wrong, but I cannot get my pdm add-in OnCMD to run on task launch.

I have the hook added in GetAddInInfo:

        //44 = The task is being launched; add your own user interface to permit user input
        poCmdMgr.AddHook(EdmCmdType.EdmCmd_TaskLaunch);

in the OnCmd function switch I have:

          case EdmCmdType.EdmCmd_TaskLaunch:

but it is not being called.

When debugging I learned from my VAR to use PauseToAttachProcess(string) , that is before the switch statement and it is not running either.

    public void OnCmd(ref EdmLib.EdmCmd poCmd, ref System.Array ppoData)
    {
      // check for Machine Name of my development VM, I would set that machine as task host when debugging.
      if (System.Environment.MachineName.Contains("O1CDL01"))
      {
        PauseToAttachProcess(poCmd.meCmdType.ToString());
      }
      try
      {
        switch (poCmd.meCmdType)
        {

It seems like OnCmd is not being called when the task is run. I am testing this by running the task from right click menu. I’m don’t usually need to restart for changes to take effect, I will exit pdm though to force the edmserver.exe process to restart.

Check for the following things:

  • Make sure the task add-in is permitted.
  • Make sure you have permissions as a PDM user to run the task from the task setup dialog.
  • As developer, you should set the execution method to execute on the computer where it launched the task.
  • Make sure the task has the proper flags.
  • Run taskkill -f -im edmserver.exe and for explorer.exe two to make sure the proper version of the add-in gets loaded.

It’s important to remember that Launch and Run will run in two separate processes. I think you might have forgotten to attach to the second because the VS debugger was already attached to the process where Launch was triggered.

Check for the following things:

  • Make sure the task add-in is permitted.

    • permitted? Not sure which setting you’re referring to here.
  • Make sure you have permissions as a PDM user to run the task from the task setup dialog.

    • logged into PDM client as user that is in admins group. admins group has permissions to run the task. Is this a correct setup?
  • As developer, you should set the execution method to execute on the computer where it launched the task.

    • We’re using a task host server to run the tasks, the task should not Run on client side. Can I not use the TaskLaunch hook to run code on the client if the task is run on a task host machine?
  • Make sure the task has the proper flags.

    • I’m sorry, I don’t know what this means.
  • Run taskkill -f -im edmserver.exe and for explorer.exe two to make sure the proper version of the add-in gets loaded.

    • check!

It’s important to remember that Launch and Run will run in two separate processes.

Maybe I’m confused, I thought Launch runs on the client machine when the user causes the task to be run, either by menu or transition action. Then the Run executes on the task host according to the “Execution Method” step of setting up the task in the PDM Admin Tool? But no matter which of the three options is selected the Launch should still run on the client right?

I think you might have forgotten to attach to the second because the VS debugger was already attached to the process where Launch was triggered.

I have attached to the Run process before when I set my development machine as the task host, but I have not been able to attach the Launch process. Actually I’m not even sure which process to attach debugger for the Launch step. I’ve tried EdmServer.exe and the ViewServer.exe, both showed that the break points will not be hit.

I’m assuming the Launch add-in code runs on the client machine and that machine does not need to be configured as a Task Host.

I realized I was using edmLib instead of EPDM.Interop.epdm I have changed that now, I like using the EdmCmdData[] much better than the System.array. It doesn’t seem to have made a difference. I cannot find a way to indicate that the OnCmd function is being called on task Launch. I’ve used MessageBox.Show(“test”); which works on task run, task setup, task setup button.

I have also tried using ((IEdmVault5)poCmd.mpoVault).MsgBox(0, “HEY!”); in the OnCmd function before the switch statement.

Hm. How open are you to doing a quick zoom call to debug your code. I’m pretty sure it is one of those things above?

I might have to take you up on your offer. I’m starting a new addin from scratch to get a clean slate. Also thinking about trying the suggested debugging method kindly laid out here. I have not yet used this method.

Let me see if the fresh start will work.

I’m available 1:30 PM PT. Send me your email to amen@bluebyte.biz if you got time.
Task add-ins not “debuggeable” that way.

Ok. found the problem, I’m an idiot.
EdmTaskFlag.EdmTask_SupportInitExec was my problem just as you suggested. Then making sure I closed all the processes to the new dlls load, then running the task setup again to get the new flags loaded.

Exactly (Not the idiot part :smiley: ). That’s the one of the task flags.

1 Like