.NET core exception

We noticed that the .Net core Agent throws an exception when some headers are repeated. In this specific case Content-Type header with a value "application/json" was specified twice in the request and resulted in an exception. I understand that is is not a valid use case , but it might something to clean up.

{ "time": "2019-09-20 14:18:59.9471", "application_trace_id": "0HLPTVNSIHH2O:00000005", "user_id": "561b95df-3047-47b5-b82d-a4e88c892bd2", "level": "ERROR", "nested": { "message": "Connection id "0HLPTVNSIHH2O", Request id "0HLPTVNSIHH2O:00000005": An unhandled exception was thrown by the application.", "exception": "System.FormatException: The specified content type is invalid.\n at System.Net.Mime.ContentType.ParseValue()\n at System.Net.Mime.ContentType..ctor(String contentType)\n at Elastic.Apm.AspNetCore.ApmMiddleware.FillSampledTransactionContextRequest(HttpContext context, Transaction transaction)\n at Elastic.Apm.AspNetCore.ApmMiddleware.InvokeAsync(HttpContext context)\n at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)" }, "ConnectionId": "0HLPTVNSIHH2O", "TraceIdentifier": "0HLPTVNSIHH2O:00000005", "EventId_Id": 13, "EventId_Name": "ApplicationError", "EventId": "ApplicationError" }

Thanks for reporting this @apm_user

I looked at the code, and I see where the problem is - this should be an easy fix. I opened an issue for it: https://github.com/elastic/apm-agent-dotnet/issues/502 - feel free to watch that for progress.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.