Actor source generator does not copy generic constraints for type parameters
Expected Behavior
Given the following actor interface:
using Dapr.Actors.Generators;
using System.Threading.Tasks;
namespace Test
{
public interface ITrait
{
string GetName();
}
[GenerateActorClient]
public interface ITestActor<TTrait> where TTrait : ITrait
{
Task<bool> SetTrait(TTrait trait);
Task<TTrait> GetTrait(string name);
}
}
it should generate a class definition like this:
public sealed class TestActorClient<TTrait> : Test.ITestActor<TTrait> where TTrait : Test.ITrait
...
Actual Behavior
instead, it generates this:
public sealed class TestActorClient<TTrait> : Test.ITestActor<TTrait>
...
The constraints are not copied.
Steps to Reproduce the Problem
Use the DAPR source generator package with the above actor interface, then examine the analyzer output (or try to compile it.) It will fail.
Release Note
RELEASE NOTE:
This is not of immediate use but is more for completeness since dapr dotnet actors currently forbid generic methods due to old service fabric limitiations (soap + datacontract serializer) but it would work with system.text.json serialization.
Especially with the upcoming changes to the actor runtime to support streaming and pubsub, this might introduce a good opportunity to release a next-gen actors SDK that seeks to break from the older limitations and work with more generic serialization support. This isn't likely for the 1.16 release as it'd be a lot of work, but this is certainly worth keeping in mind.
Especially with the upcoming changes to the actor runtime to support streaming and pubsub, this might introduce a good opportunity to release a next-gen actors SDK that seeks to break from the older limitations and work with more generic serialization support. This isn't likely for the 1.16 release as it'd be a lot of work, but this is certainly worth keeping in mind.
What do you mean next-get actor sdk? What is planned to change?