Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

SignalR source generators shouldn't include Compilation in the pipeline #45663

Open
Youssef1313 opened this issue Dec 18, 2022 · 0 comments
Open
Labels
area-signalr Includes: SignalR clients and servers

Comments

@Youssef1313
Copy link
Member

See dotnet/roslyn-analyzers#6352

These pipelines are not efficient and this generator is not really incremental.

var methodDeclaration = context.SyntaxProvider
.CreateSyntaxProvider(static (s, _) => Parser.IsSyntaxTargetForAttribute(s),
static (ctx, _) => Parser.GetSemanticTargetForAttribute(ctx))
.Where(static m => m is not null)
.Collect();
var memberAccessExpressions = context.SyntaxProvider
.CreateSyntaxProvider(static (s, _) => Parser.IsSyntaxTargetForGeneration(s),
static (ctx, _) => Parser.GetSemanticTargetForGeneration(ctx))
.Where(static m => m is not null);
var compilationAndMethodDeclaration = context.CompilationProvider.Combine(methodDeclaration);
var payload = compilationAndMethodDeclaration
.Combine(memberAccessExpressions.Collect());
context.RegisterSourceOutput(payload, static (spc, source) =>
Execute(source.Left.Left, source.Left.Right, source.Right, spc));

var methodDeclaration = context.SyntaxProvider
.CreateSyntaxProvider(static (s, _) => Parser.IsSyntaxTargetForAttribute(s),
static (ctx, _) => Parser.GetSemanticTargetForAttribute(ctx))
.Where(static m => m is not null)
.Collect();
var memberAccessExpressions = context.SyntaxProvider
.CreateSyntaxProvider(static (s, _) => Parser.IsSyntaxTargetForGeneration(s),
static (ctx, _) => Parser.GetSemanticTargetForGeneration(ctx))
.Where(static m => m is not null);
var compilationAndMethodDeclaration = context.CompilationProvider.Combine(methodDeclaration);
var payload = compilationAndMethodDeclaration
.Combine(memberAccessExpressions.Collect());
context.RegisterSourceOutput(payload, static (spc, source) =>
Execute(source.Left.Left, source.Left.Right, source.Right, spc));

Every typed character in IDE will produce a new compilation and the whole thing will re-run. This doesn't benefit from being incremental.

@TanayParikh TanayParikh added the area-signalr Includes: SignalR clients and servers label Dec 18, 2022
@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 13, 2024
@dotnet dotnet deleted a comment from dotnet-policy-service bot Feb 13, 2024
@dotnet dotnet deleted a comment from dotnet-policy-service bot Feb 13, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area-signalr Includes: SignalR clients and servers
Projects
None yet
Development

No branches or pull requests

3 participants