The outer ConfigureScope call no longer allocates a closure, but this OnEvaluating event handler still allocates unconditionally. One solution might be to store KeyValuePairs of the callback and its argument instead of using an event inside a Stack. Perhaps the Stack wouldn't even be necessary when the Sentry.AspNetCore.Grpc integration isn't loaded, as that seems to be the only other place (outside of tests) where this event handler is assigned.
Originally posted by @KnapSac in #4244 (comment)
Worth reading through that whole thread on the other issue before coming up with a solution (and probably worth putting some benchmarks together - possibly some load tests as well).
The outer
ConfigureScopecall no longer allocates a closure, but thisOnEvaluatingevent handler still allocates unconditionally. One solution might be to storeKeyValuePairs of the callback and its argument instead of using an event inside aStack. Perhaps theStackwouldn't even be necessary when theSentry.AspNetCore.Grpcintegration isn't loaded, as that seems to be the only other place (outside of tests) where this event handler is assigned.Originally posted by @KnapSac in #4244 (comment)
Worth reading through that whole thread on the other issue before coming up with a solution (and probably worth putting some benchmarks together - possibly some load tests as well).