-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Consider not throwing for completed but unsuccessful long-running operations #21312
Comments
@kinelski pointed out that this would be against our current guidelines. cc @christothes who worked on Azure/azure-sdk#2003 |
When I implemented the LROs for Key Vault (real and pseudo-LROs) back in 2019, @KrzysztofCwalina recommended we throw from |
No, I think you were right. The |
@tg-msft: it would be good to scope this to DPG libraries; consider pointing customers to RequestContext to control error experience. It would be good to understand the experience in the HLC libraries as well. |
Do we see us doing this for exsiting HLCs? For DPG and newer light-up APIs we already have a means to achieve this behavior albeit as an advanced scenario. Do we see us changing this to mainstream scenario however? |
@pallavit: @JoshLove-msft is driving this investigation and can make a recommendation based on his findings once available. |
@JoshLove-msft could you please share your current thinking here? |
The scope of my investigation was to determine whether or not the current shared source implementation actually aligns with the current guidelines and whether the guidelines may need updating to reflect the behavior. The guidelines say that UpdateStatus should throw if the operation completed with a failed result. They also state that accessing the Operation
The shared source implementation throws on failed results in UpdateStatus. It also throws the same exception when accessing So our official guidance in the implementation guidelines matches up with the Azure.Core shared source implementation. The problem is that many LRO's created before the Azure.Core shared source implementation, such as Key Vault's , did the implementation themselves and do not follow the guidelines of throwing on a failed result from I do think there is room for improvement by adding a static analyzer. A simple analyzer could verify these conditions for any |
Thank you for sharing the details @JoshLove-msft
As for this, I think we should open a bug in azure-sdk-tools for static analyzer. I agree with you that older SDKs would likely not be updated due to breaking changes concerns however this may be valuable for net new SDKs branded as well as other 3rd party scenarios in future. Even though LROs is a azure specific concept it may be worth evaluating it for the new toolchain as well so having a static analyzer bug for this will be useful. I would suggest tagging that issue with System.ClientModel as well so we think this scenario from that perspective as well. Let me know what you think? |
Works for me - filed Azure/azure-sdk-tools#7478. |
Azure/autorest.csharp#464
From @heaths :
The text was updated successfully, but these errors were encountered: