Update: Microsoft will be moving away from UserVoice sites on a product-by-product basis throughout the 2021 calendar year. We will leverage 1st party solutions for customer feedback. Learn more here.


My feedback

  1. 24 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    You have left! (?) (thinking…)
    2 comments  ·  Automation » Debugging and troubleshooting  ·  Flag idea as inappropriate…  ·  Admin →
    under review  ·  Beth Cooper responded

    Can you provide more detail on what you mean by useful? Do you want to know where in the code the error occurred? Can you provide an example of what you find useful for debugging PS in the ISE?

    You may want to try using ErrorRecord.InvocationInfo for non-terminating errors since on non-terminating errors, we currently save this data in the Error stream.

    On terminating errors (exceptions), this data is currently lost. But we can investigate storing this information to present it for debugging. I would like to make sure that this is the info that you are looking for though, so please confirm.

    As a workaround for now, you could write a global try/catch block in the runbook (which will also catch exceptions thrown because of $ErrorActionPreference = ‘Stop’) and write $_.ErrorRecord.InvocationInfo to a stream.

    An error occurred while saving the comment
    Alexander commented  · 


    This is still an issue that deserves attention! In Azure automation, terminating erros show up under the exception tab without any invocation information, line number etc.

    I have made a simple test where I invoke a divide by zero error. If I write the exception via Write-Output, it looks right:

    Attempted to divide by zero.

    At C:\Temp\0ve0pqqg.2c0\Invoke-DivideByZeroErr.ps1:2 char:1

    + $i = 1 / 0

    + ~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], RuntimeException
    + FullyQualifiedErrorId : RuntimeException

    In the exception tab however, I only get this rather limited piece of text from the exception:

    Attempted to divide by zero. (Attempted to divide by zero.)

    Please prioritize!

    Alexander supported this idea  · 

Feedback and Knowledge Base