Return full stacktrace on service startup failures
See original GitHub issueIs 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.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
I improved the example here - https://github.com/grpc/grpc-dotnet/pull/1841
Oh I see, I just copied the sample code verbatim and didn’t look too closely at it, so that’s where it’s getting dropped then:
Also any thoughts on why the
IConfiguration
isn’t loading values fromappsettings.json
in the test?