locked
A workflow cannot use recursion RRS feed

  • Question

  • I have this code in my module (psm1). The code works - that is not the issue.

    Workflow Test-WFConnection {
    
        # Run multiple parallel "pings" so it runs quicker
    
      param(
        [string[]]$Computers
      )
    
      foreach -parallel ($computer in $computers) {
    
          [pscustomobject]@{
            Computer = $computer
            Reachable = (Test-Connection -ComputerName $computer -Count 1 -Quiet)
          }
      }
    }
    

    Since I installed WMF 5.x I get the error 'A workflow cannot use recursion' when I do the import-module cmdlet.

    Before WMF 5.x this exact code did not generate that error.

    Does anyone know what has changed?

    Thanks

    David

    • Moved by Bill_Stewart Thursday, January 25, 2018 9:50 PM This is not break/fix forum
    Wednesday, October 11, 2017 10:33 PM

All replies

  • Works fine for me.  Perhaps your module is not built correctly.


    \_(ツ)_/

    Wednesday, October 11, 2017 11:35 PM
  • Thanks Joe.

    The code is in exactly the same place in the module as its always been.

    The module contains this workflow and a bucketload of functions.

    Wednesday, October 11, 2017 11:49 PM
  • No way to know the answer.  You will have to debug the module.


    \_(ツ)_/

    Wednesday, October 11, 2017 11:53 PM
  • hmm I removed the workflow code above from the psm1 file and the error disappears.
    Thursday, October 12, 2017 12:01 AM
  • Are you trying to call the workflow from within the module?

    You might just be facing a bug.


    \_(ツ)_/

    Thursday, October 12, 2017 12:11 AM
  • no - not calling the workflow from within the module. Its a bug...
    Thursday, October 12, 2017 12:24 AM
  • Create a module with only the workflow and add back one function at a time.  It may just be a conflict.

    \_(ツ)_/

    Thursday, October 12, 2017 12:26 AM