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

Modify task extensions to support backgroundTask #260

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

amongonz
Copy link

I noticed the for-loop extension to the task CE doesn't work with backgroundTask because the code extends TaskBuilder instead of the more general TaskBuilderBase, from which both TaskBuilder and BackgroundTaskBuilder inherit.

This PR does the small change to support backgroundTask as well.

Modifies the extensions to TaskBuilder to extend TaskBuilderBase
instead, so they apply to both the task and backgroundTask builders.
@abelbraaksma
Copy link
Member

abelbraaksma commented Feb 20, 2025

Oops, your PR went unnoticed for some time, sorry about that!

Thanks @amongonz for finding this bug and tackling it. I will need some accompanying tests to ensure that if anyone changes this again, it will break. I think a single test that didn't compile before with BackgroundTask and now does work with it, would suffice to tackle this.

Don't worry if you don't have time to add a test, I can do that as well ;).

// Add asynchronous for loop to the 'task' computation builder
type Microsoft.FSharp.Control.TaskBuilder with
// Add asynchronous for loop to the 'task' and 'backgroundTask' computation builders
type TaskBuilderBase with
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test that shows the use of TaskBuilderBaseBuilder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants