Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Offer CancellationToken support in IProgram (.NET 7) #86

Closed
1 task done
alexrp opened this issue May 22, 2022 · 1 comment
Closed
1 task done

Offer CancellationToken support in IProgram (.NET 7) #86

alexrp opened this issue May 22, 2022 · 1 comment
Labels
area: samples Issues related to the sample projects. type: feature Issues that are classified as feature requests.
Milestone

Comments

@alexrp
Copy link
Sponsor Member

alexrp commented May 22, 2022

Depends on:

Something like:

public interface IProgram
{
    public static virtual bool SupportsCancellation => true;

    public static abstract Task RunAsync(ProgramContext context);
}

If SupportsCancellation is true, ProgramHost will wire up a Signaled event handler to trigger a CancellationTokenSource whose CancellationToken gets passed as a property on ProgramContext.

(The reason for making cancellation support optional is that wiring up Signaled has side effects that may not be tolerable - see #64.)

@alexrp alexrp added type: feature Issues that are classified as feature requests. state: approved Feature requests and housekeeping tasks that have been approved. area: samples Issues related to the sample projects. area: hosting labels May 22, 2022
@alexrp alexrp added this to the v1.0 milestone May 22, 2022
@alexrp alexrp self-assigned this May 22, 2022
@alexrp alexrp changed the title Offer CancellationToken support in IProgram Offer CancellationToken support in IProgram (.NET 7) Jul 7, 2022
@alexrp
Copy link
Sponsor Member Author

alexrp commented Jul 7, 2022

This can only happen in .NET 7 as the Roslyn shipped with .NET 6 does not support static virtual members.

@alexrp alexrp added state: blocked Issues that are blocked on some other issue/work. state: approved Feature requests and housekeeping tasks that have been approved. and removed state: approved Feature requests and housekeeping tasks that have been approved. state: blocked Issues that are blocked on some other issue/work. labels Oct 16, 2022
@alexrp alexrp closed this as completed in 00f9281 Oct 28, 2022
@alexrp alexrp removed the state: approved Feature requests and housekeeping tasks that have been approved. label Oct 28, 2022
@alexrp alexrp removed their assignment Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: samples Issues related to the sample projects. type: feature Issues that are classified as feature requests.
Development

No branches or pull requests

1 participant