VSTS版本仅将Powershell异常的第1行记录为错误。如何在不启用调试的情况下记录完整的异常详细信息?

VSTS版本仅将Powershell异常的第1行记录为错误。如何在不启用调试的情况下记录完整的异常详细信息?,powershell,azure-pipelines-release-pipeline,Powershell,Azure Pipelines Release Pipeline,如果我在Powershell ISE中运行此代码(包含空引用) $result = $nonExistentString.Substring(0,4) 将引发异常,并将以下内容输出到控制台 You cannot call a method on a null-valued expression. At line:1 char:1 + $result = $nonExistentString.Substring(0,4) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

如果我在Powershell ISE中运行此代码(包含空引用)

$result = $nonExistentString.Substring(0,4)
将引发异常,并将以下内容输出到控制台

You cannot call a method on a null-valued expression.
At line:1 char:1
+ $result = $nonExistentString.Substring(0,4)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
但是,如果我在VSTS版本中运行与powershell内联脚本相同的代码,则发布日志将只输出以下内容:

2017-11-30T13:23:26.9471504Z ##[error]You cannot call a method on a null-valued expression.

这不够详细,无法在更复杂的脚本中帮助解决问题。我知道我可以在调试模式下运行脚本,并且完整的异常记录被记录为调试条目,但这意味着我们需要始终在调试中运行所有脚本,以便在发生异常时获得完整的异常详细信息。有人知道是否可以将VST配置为记录完整的异常详细信息,而无需启用调试

VSTS发布日志显示与您在Powershell ISE中执行的错误相同的错误。消息
+$result=$nonExistentString.Substring(0,4)+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~类别信息:无效操作:(::)[,运行时异常+FullyQualifiederRoid:invokeMet无法对空值表达式调用方法。
。VSTS发布日志显示与在Powershell ISE中执行相同的错误。消息
+$result=$nonExistentString.Substring(0,4)+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~类别信息:无效操作:(::)[,运行时异常+FullyQualifiederRoid:invokeMet不能对空值表达式调用方法