Uh oh!
There was an error while loading. Please reload this page.
Re-introduce default cancellationToken for PurgeInstanceAsync for backwards compatibility - #276
Re-introduce default cancellationToken for PurgeInstanceAsync for backwards compatibility#276David Justo (davidmrdavid) wants to merge 1 commit into
PurgeInstanceAsync for backwards compatibility#276Conversation
…ackwards compatibility
| /// <inheritdoc cref="PurgeInstanceAsync(string, PurgeInstanceOptions, CancellationToken)"/> | ||
| public virtual Task<PurgeResult> PurgeInstancesAsync(string instanceId, CancellationToken cancellation) | ||
| public virtual Task<PurgeResult> PurgeInstancesAsync(string instanceId, CancellationToken cancellation = default) |
There was a problem hiding this comment.
From a binary compatibility perspective, this is still a breaking change. We need to introduce a virtual method that doesn't include the CancellationToken parameter at all.
publicvirtualTask<PurgeResult>PurgeInstancesAsync(stringinstanceId,CancellationTokencancellation)=>this.PurgeInstanceAsync(instanceId,CancellationToken.None);There was a problem hiding this comment.
Wait, maybe my suggestion isn't the right one. I'd need to double check where the failure is coming from.
There was a problem hiding this comment.
I'll be honest, I haven't had the chance to validate my diff yet either. Just FYI
David Justo (davidmrdavid)
commented
Mar 25, 2024
Before I forget - let's validate that there weren't other similar breaking changes (in other client methods) that the test didn't catch but still need resolving. |
| /// <inheritdoc cref="PurgeInstanceAsync(string, PurgeInstanceOptions, CancellationToken)"/> | ||
| public virtual Task<PurgeResult> PurgeInstancesAsync(string instanceId, CancellationToken cancellation) | ||
| public virtual Task<PurgeResult> PurgeInstancesAsync(string instanceId, CancellationToken cancellation = default) |
There was a problem hiding this comment.
Adding the default param back will cause ambiguous overload resolution with
publicvirtualTask<PurgeResult>PurgeInstanceAsync(stringinstanceId,PurgeInstanceOptions?options=null,CancellationTokencancellation=default)when calling .PurgeInstanceAsync(string) (which of the 2 default param methods is it to use?)
We will also need to remove the default param from options in that other method.
| /// <inheritdoc cref="PurgeInstanceAsync(string, PurgeInstanceOptions, CancellationToken)"/> | ||
| public virtual Task<PurgeResult> PurgeInstancesAsync(string instanceId, CancellationToken cancellation) | ||
| public virtual Task<PurgeResult> PurgeInstancesAsync(string instanceId, CancellationToken cancellation = default) |
There was a problem hiding this comment.
Oh! the error message you see of no overload resolution is because of the typo in #267
David Justo (davidmrdavid)
commented
Mar 26, 2024
Closing this as the expected bug fix was merged. |
Follow-up to: #262
It would appear that in the refactoring above we accidentally made a breaking change to our
PurgeInstancesAsyncAPI, dropping the declaration of aPurgeInstanceAsync(string instanceId, CancellationToken cancellation = default)method, which is overriden here.At a glance, I suspect this is the reason for our smoke test failures in the
worker.extensions.durabletaskpackage: https://github.com/Azure/azure-functions-durable-extension/actions/runs/8428205010/job/23080260061?pr=2772Failure trace:
This PR is a naive attempt at trying to fix them.