Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Azure Function 2.0不会为应用程序洞察提供例外情况_C#_Azure_Asp.net Core_Azure Functions_Azure Application Insights - Fatal编程技术网

C# Azure Function 2.0不会为应用程序洞察提供例外情况

C# Azure Function 2.0不会为应用程序洞察提供例外情况,c#,azure,asp.net-core,azure-functions,azure-application-insights,C#,Azure,Asp.net Core,Azure Functions,Azure Application Insights,Azure Function 2.0不提供以下应用程序洞察的例外情况 我编写了以下方法来向app insights报告异常: public void PublishOperationResult(Exception ex, string CustomMessage, Guid invocationId) { var _client = new TelemetryClient { InstrumentationKey = "my-key" };

Azure Function 2.0不提供以下应用程序洞察的例外情况

我编写了以下方法来向app insights报告异常:

public void PublishOperationResult(Exception ex, string CustomMessage, Guid invocationId)
{
     var _client = new TelemetryClient
     {
         InstrumentationKey = "my-key"
     };

     _client.Context.Operation.Id = invocationId.ToString();
     _client.Context.Operation.Name = "SnapshottingViewsException";

     var exception = new ExceptionTelemetry(ex);

     var properties = new Dictionary<string, string>
     {
         {"CustomMessage", CustomMessage}
     };

     foreach (var property in properties)
     {
         exception.Properties.Add(property);
     }

     _client.TrackException(exception);
}
如果禁用此功能并仅抛出异常,则一切都会按预期工作

版本:

Microsoft.NetCoreApp 2.1.0
Microsoft.SDK.Functions 1.0.29
Microsoft.ApplicationInsights.AspNetCore 2.7.1
算是解决了

我正在测试的异常来自一个SQL客户机。当抛出时,AppInsights将其视为异常,但当TelemetryClient报告时,它将被视为具有不同消息/标题的依赖项错误,我没有查找该消息/标题。因此更难发现

Microsoft.NetCoreApp 2.1.0
Microsoft.SDK.Functions 1.0.29
Microsoft.ApplicationInsights.AspNetCore 2.7.1