cathode
cathode copied to clipboard
Offer `CancellationToken` support in `IProgram` (.NET 7)
Depends on:
- [x] #103
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.)
This can only happen in .NET 7 as the Roslyn shipped with .NET 6 does not support static virtual members.