public async Task <TResponse> Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate <TResponse> next) { TResponse response; var client = _telemetryProvider.GetClient <TelemetryClient>(); try { client.TrackTrace(System.Text.Json.JsonSerializer.Serialize(request, request.GetType())); response = await next(); client.TrackTrace(System.Text.Json.JsonSerializer.Serialize(response, response.GetType())); } catch (Exception e) { client.TrackException(e); throw; } return(response); }