dapr / dapr/dotnet-sdk

Failing resiliency feature (like retry) does not throw InvocationException

Open
#970 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.2k
Forks
378
Avg merge
1d 22h
Merged PRs (30d)
5

Description

When using a Resiliency feature like retries with the .NET SDK client (e.g. with `InvokeMethodWithResponseAsync`) and the retry is finally unsuccessful, an `InvocationException` is not thrown.

This is due to the .NET client - on purpose! - not handling the HTTP 500 code, which the sidecar returns in such a case.
https://github.com/dapr/dotnet-sdk/blob/e87b9ad6eefaa05390144d82642df13c5b4bed17/src/Dapr.Client/DaprClientGrpc.cs#L304

A repro can be seen here:
https://github.com/thinktecture/dapr-basics-demos

When starting the client project in the debugger (without the service) and the retries are finally failing, I get an `HttpRequestException` in the calling code:

image

Actually, I would expect a `DaprException` in this case, with details on why the invocation failed.
@halspang

The sidecar answers with this:
```json
{
"errorCode":"ERR_DIRECT_INVOKE",
"message":"fail to invoke, id: service-daprized, err: couldn't find service: service-daprized"
}
```

Looking further into the source code of the .NET client, it seems that I should rather use this method here?
https://github.com/dapr/dotnet-sdk/blob/e87b9ad6eefaa05390144d82642df13c5b4bed17/src/Dapr.Client/DaprClientGrpc.cs#L349

But we (still) do not get any indication of why the call failed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.