Skip to content

Actor source generator does not copy generic constraints for type parameters #1534

Open
@oising

Description

@oising

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:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions