dapr / dapr/dotnet-sdk

Actor descriptions do not take interface inheritance into account

Open
#694 2 comments 0 reactions 1 assignee Claimed by @halspang View on GitHub
Dominant language
C#
Stars
1.2k
Forks
378
Avg merge
1d 22h
Merged PRs (30d)
5

Description

Based on:

> @eNeRGy164 - can you please separate this commit from this PR and open an issue to discuss. Any behavior changes need to be really well understood.
>
> I suspect that this is a breaking change we would not accept until the next major release as it *tightens* validation we're performing. We need to talk through all of the possible cases that would be impacted.
>
> _Originally posted by @rynowak in https://github.com/dapr/dotnet-sdk/pull/684#discussion_r646188069_

# Issue
If an interface inherits from another interface (that does inherit from `IActor`. The inherited methods are not detected.

This is because the `Type.GetMethods` method does not return inherited methods from interfaces (in contrast to `class`es.

This resuts in 2 effects.
1. For inherited methods no method descriptions are generated
2. The detection for overloads will not generate an exception when the two overloads are declared on different interfaces.

For example:

```csharp
internal interface IMethodActor : IActor
{
Task GetString();

Task MethodWithArguments(int number, bool choice, string information);
}

internal interface IOverloadedActor : IMethodActor
{
Task GetString(string parameter);
}
```

`IOverloadedActor` would be described as only having the `GetString(string)` method and there would not be an exception that the `GetString` method is overloaded.

I created an implementation that does detect method from inheritance, but this would probably be a breaking change.

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.