Azure Function (ServiceBus) System.Private.CoreLib 错误(在本地工作)

Azure Function (ServiceBus) System.Private.CoreLib Error (Works locally)

当我 运行 我的 Azure 在本地运行时,它们就像一个魅力。 但是,当我在云中发布并 运行 它们时,出现以下错误:

[Error] System.Private.CoreLib: Exception while executing function: Alert. Function.PowerBI: Abandom message in AzureFunction.PowerBi.

运行 在一个名为 PowerBi 的函数中有一个名为 Alert 的函数。 有没有办法,也许在 Kudu 中可以看到实际的错误,或者我应该如何解释

中的错误

System.Private.CoreLib

代码:

    [FunctionName("Alert")]
    public static async Task Alert([ServiceBusTrigger(Topic.Alert, Subscription.PowerBi, Connection = "servicebusconnectionstring")] Message message, TraceWriter log)
    {
        if (!MessageHandler.Validate(message, Subscription.PowerBi))
            return;

        var json = Encoding.UTF8.GetString(message.Body);
        var messageCounter = message.SystemProperties.DeliveryCount;

        try
        {
            var alert = Validator.ValidateCloudAlert(json);
            if (alert != null)
            {
                var powerBiAlert = alert.ToPowerBiAlert();
                var result = await PowerBiService.AddRow(powerBiAlert);
                if (!result)
                    throw new PowerBiCommandException($"PowerBiService.AddRows returned value: {result}");
            }
        }
        catch (Exception e)
        {
            EventLogger.LoggException("Function.PowerBi.Alert", e, new Dictionary<string, string>() { { "Messsage", json } });
            if (messageCounter >= 5)
            {
                EventLogger.LoggEvent("DeadLetterQueue", new Dictionary<string, string>() { { "Function", "Function.PowerBi.Alert" }, { "Messsage", json } });
                await QueueService.SendAsync(Queue.Deadletter, JsonConvert.DeserializeObject<CloudAlert>(json), Topic.Alert, Subscription.PowerBi);
            }
            else
                throw new MessageAbandonException($"Abandom message in AzureFunction.PowerBi");
        }
    }

感谢您的帮助!

包含的以下包使 Azure 函数停止工作:

PackageReference Include="System.Dynamic.Runtime" Version="4.3.0"

有没有办法更容易地找出这个问题,这次我只是删除了一行代码,直到我发现问题所在。非常耗时。即使您建议使用 Application Insights(我这样做),也很难找到真正的问题。我只需要花一些时间看看它发生在哪一行,并尝试删除与它相关的所有 nugets,直到我找到问题。