microsoft / microsoft/sqlmanagementobjects
Can TaskCompletionSource be used with Backup class?
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 143
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Description
I would like a method to call Backup.SqlBackupAsync and return a TaskCompletionSource.Task in order to await the completion of the Backup process.
Currently, the Backup.Wait() method appears to be the only definitive way to know when a Backup.SqlBackupAsync(Server) call has completed entirely. Is there another way that does not require calling a blocking method?
The Complete event is unreliable because if there's an error the Complete event is never raised.
The Information event is unreliable because there's no way to know when the "final" Information event has been raised.
The PercentageComplete event is unreliable because, at least in some cases, an error causes the event to not be raised at all.
My current methodology is to call Backup.Wait() via Task.Run() and return that Task. This is functional, but not ideal, because it's creating a new thread whose entire job is to wait.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining Backup.SqlBackupAsync(Server), Backup.Wait(), and the Complete, Information, and PercentageComplete events described in the issue. Determine how completion and errors are surfaced, then verify that the proposed awaitable approach avoids a blocking wait and reliably reports the backup outcome.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100