The most common method for debugging in Custom code in a BPM is to write to the event log.
like: Ice.Diagnostics.Log.WriteEntry(msg)
Ice.Diagnostics.Log.WriteEntry(msg)
more details in topic: