-
Notifications
You must be signed in to change notification settings - Fork 814
Description
Is your feature request related to a problem? Please describe.
I'd like to see if service stacktraces can be bubbled up during service startup.
While writing integration tests for a service the gRPC call would fail with an unknown error and the detailed error messages and adding log interceptors didn't make it any clearer to me where the issue was. The root cause was IConfiguration wasn't being passed into my service on startup during the test so some values were null and causing the service to not start up, but if the stackstrace was easily available, without having to debug the pkg, it would have reduce the amount of code to look though for the cause.
Describe the solution you'd like
Specifically this call was discarding the stacktrace during startup due to the finally, could we catch the exception and bubble it up here?
private async Task<TResponse> ResolvedInterceptorInvoker(TRequest resolvedRequest, ServerCallContext resolvedContext)
{
GrpcActivatorHandle<TService> serviceHandle = default;
try
{
serviceHandle = ServiceActivator.Create(resolvedContext.GetHttpContext().RequestServices);
return await _invoker(serviceHandle.Instance, resolvedRequest, resolvedContext);
}
finally
{
if (serviceHandle.Instance != null)
{
await ServiceActivator.ReleaseAsync(serviceHandle);
}
}
}Describe alternatives you've considered
Log interceptors weren't that helpful since it doesn't tell you which code the error came from.
Additional context
It would also be nice if IConfiguration was injected during the test, but that's likely a different ticket.