Skip to content

Source generator should sanitize method names #33

@cgillum

Description

@cgillum

If the "name" value of the [DurableTask(name)] attribute isn't a valid C# identifier, the source generator will still generate a method using this invalid name.

For example, defining an activity like this:

[DurableTask("Foo.Bar")]
class FooBarActivity : TaskActivityBase<object, object>
{
    // ...
}

Results in generated output like this, which doesn't compile:

public static Task<object> CallFoo.BarAsync(this TaskOrchestrationContext ctx, object input, TaskOptions? options = null)
{
    return ctx.CallActivityAsync<object>("Foo.Bar", input, options);
}

Instead, the method name should be normalized into something valid, like this:

public static Task<object> CallFooBarAsync(this TaskOrchestrationContext ctx, object input, TaskOptions? options = null)
{
    return ctx.CallActivityAsync<object>("Foo.Bar", input, options);
}

Metadata

Metadata

Labels

P2bugSomething isn't workingsource generatorsIssue relates to the source generator project(s)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions