Fix System.InvalidCastException in Grpc during Header Removal#7975
Merged
Fix System.InvalidCastException in Grpc during Header Removal#7975
System.InvalidCastException in Grpc during Header Removal#7975Conversation
andrewlock
approved these changes
Dec 19, 2025
tracer/test/test-applications/integrations/Samples.GrpcLegacy/ClientWorker.cs
Outdated
Show resolved
Hide resolved
.Get isn't available in ealier versions of Grpc
Co-authored-by: Andrew Lock <andrew.lock@datadoghq.com>
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (7975) and master. ✅ No regressions detected - check the details below Full Metrics ComparisonFakeDbCommand
HttpMessageHandler
Comparison explanationExecution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). Duration chartsFakeDbCommand (.NET Framework 4.8)gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7975) - mean (69ms) : 67, 70
master - mean (68ms) : 66, 70
section Bailout
This PR (7975) - mean (72ms) : 71, 73
master - mean (72ms) : 71, 73
section CallTarget+Inlining+NGEN
This PR (7975) - mean (1,010ms) : 963, 1058
master - mean (1,006ms) : 968, 1044
FakeDbCommand (.NET Core 3.1)gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7975) - mean (107ms) : 103, 110
master - mean (106ms) : 103, 108
section Bailout
This PR (7975) - mean (108ms) : 106, 109
master - mean (107ms) : 105, 108
section CallTarget+Inlining+NGEN
This PR (7975) - mean (723ms) : 690, 756
master - mean (712ms) : 678, 746
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7975) - mean (96ms) : 93, 99
master - mean (94ms) : 92, 96
section Bailout
This PR (7975) - mean (97ms) : 94, 99
master - mean (94ms) : 93, 95
section CallTarget+Inlining+NGEN
This PR (7975) - mean (681ms) : 646, 716
master - mean (667ms) : 643, 690
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7975) - mean (103ms) : 94, 113
master - mean (92ms) : 90, 94
section Bailout
This PR (7975) - mean (104ms) : crit, 89, 119
master - mean (93ms) : 92, 94
section CallTarget+Inlining+NGEN
This PR (7975) - mean (690ms) : crit, 632, 749
master - mean (630ms) : 614, 646
HttpMessageHandler (.NET Framework 4.8)gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7975) - mean (194ms) : 189, 200
master - mean (194ms) : 190, 199
section Bailout
This PR (7975) - mean (198ms) : 196, 199
master - mean (197ms) : 194, 200
section CallTarget+Inlining+NGEN
This PR (7975) - mean (1,128ms) : 1049, 1206
master - mean (1,117ms) : 1064, 1170
HttpMessageHandler (.NET Core 3.1)gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7975) - mean (278ms) : 274, 282
master - mean (278ms) : 272, 284
section Bailout
This PR (7975) - mean (279ms) : 275, 283
master - mean (278ms) : 274, 282
section CallTarget+Inlining+NGEN
This PR (7975) - mean (917ms) : 873, 960
master - mean (909ms) : 867, 950
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7975) - mean (272ms) : 267, 277
master - mean (271ms) : 266, 277
section Bailout
This PR (7975) - mean (271ms) : 266, 275
master - mean (270ms) : 267, 274
section CallTarget+Inlining+NGEN
This PR (7975) - mean (894ms) : 850, 937
master - mean (888ms) : 847, 929
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (7975) - mean (270ms) : 263, 277
master - mean (271ms) : 265, 277
section Bailout
This PR (7975) - mean (271ms) : 267, 274
master - mean (270ms) : 267, 274
section CallTarget+Inlining+NGEN
This PR (7975) - mean (828ms) : 807, 849
master - mean (825ms) : 808, 842
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
This resolves a
System.InvalidCastExceptionthat was happening in the GRPC client instrumentation (I think just GrpcLegacy) when we attempted to remove headers.Reason for change
Errors in Error Tracking
Implementation details
Test coverage
Updated the sample application to detect this and if it is detected it adds a tag which causes the tests to fail (and they did fail before I applied the fix).
Other details
Used #7961
/analyze-errorcommand based on the reported error in Error Tracking. Seemed to work okay, it identified the issue, follow up was able to get a reproduction quickly, but it really struggled to get the tests updated.Helpfully, the command output a document that linked to and copied the actual
Grpc.Core.Apicode that we hit 👍Saves some time searching on GitHub ourselves I guess.
This is a bit of an edge case here so I don't think very wide spread.
Reproduced Error: