Azure DevOps - PowerApps 包部署程序 - 您不能在空值表达式上调用方法

Azure DevOps - PowerApps package Deployer - You cannot call a method on a null-valued expression

我正在尝试 运行 packagedeployer 使用 PowerApps Deploy Package 并收到错误 "You cannot call a method on a null-valued expression"。 这是使用 Dynamics 365 SDK 模板创建的 CRM 包解决方案。请在 link 下方找到详细信息

https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/package-deployer/create-packages-package-deployer#create-a-package

Azure DevOps Error Screenshot

"You cannot call a method on a null-valued expression"

信息不足以解决问题,但我可以建议您解决问题的方法。

首先,在管道 Variables

中将 system.debug 值设置为“true”

然后运行再次构建,你会在日志信息的调试信息中看到详细的异常信息(前面有##[debug])。

您很可能会看到它是一个 ps1 文件引发的错误,因为错误消息 you cannot call a method on a null-valued expression 通常出现在 ps 脚本中,它应该指出在哪一行哪个字符你得到了错误。

然后,在 PowerApps Deploy Package 任务下面添加一个 PowerShell Script 任务,使用 Get-Content 方法添加一个 Inline 脚本:

Get-Content -Path {path you find in above task log information}

现在您可以查看脚本中的哪一行导致问题并找到解决问题的方法,或者更新您在问题中找到的内容 post 我们将继续。

以下是一些您可以查看的参考链接:

Troubleshoot the InvokeMethodOnNull Error with PowerShell

You cannot call a method on a null-valued expression