microsoft / ApplicationInsights-dotnet

ApplicationInsights-dotnet
MIT License
565 stars 287 forks source link

Application Insight Ingestion API failed to track Exception when StackFrame do not have method information #2836

Open thinh-ng opened 11 months ago

thinh-ng commented 11 months ago

I'm encountering an issue where some specific exception does not tracked in Application Insight. I'm using SDK 2.21.0 with net6.0

Upon debugging, I see debug log did create the exception telemetry, and no warning/error be found, but the exception still not appear in Application Insight. I tried calling the ingestion with the telemetry data directly as follow:

POST https://southeastasia-1.in.applicationinsights.azure.com/v2/track

{
  ...
  "data": {
    ...
    "baseData": {
      ...
      "exceptions": [
        {
          ...
          "parsedStack": [
            {
              ...
              "level": 4,
              "assembly": "FastExpressionCompiler.LightExpression, Version=9.0.0.0, Culture=neutral, PublicKeyToken=null",
              "line": 0
            },
          ]
        }
      ]
    }
  }
}

Resulted in 400 response

{
    "itemsReceived": 1,
    "itemsAccepted": 0,
    "errors": [
        {
            "index": 0,
            "statusCode": 400,
            "message": "109: Field 'method' on type 'StackFrame' is required but missing or empty. Expected: string"
        }
    ]
}

I added "method": "n/a" in the request and the telemetry is tracked successfully. This is likely due to the method is being inlined, so the StackFrame cannot retrieve the method info

My question is:

If you need the full telemetry data I can provide it, I didn't post it here now as I'll have to redact some data from the telemetry