-
Notifications
You must be signed in to change notification settings - Fork 4k
[Synapse]fix remove artifact throw exception ArgumentNullException #28123
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
Conversation
Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a guard to avoid calling ToString()
on an empty response content, preventing an ArgumentNullException
when removing an artifact.
- Adds a check on
ContentStream.Length == 0
to return early if the response is empty - Preserves original logic to throw an exception for non-empty content
- Updates comments to explain the new guard
Comments suppressed due to low confidence (1)
src/Synapse/Synapse/Common/Utils.cs:244
- Consider adding a unit test to cover the new empty-content branch where
ContentStream.Length == 0
.
if (result.ContentStream.Length == 0)
Co-authored-by: Copilot <[email protected]>
…m/kevinzz6/azure-powershell into Fix-synapse-remove-artifact-issue
src/Synapse/Synapse/Common/Utils.cs
Outdated
|
||
//Fix when responseContent.length is 0 responseContent?.ToString() will throw exception ArgumentNullException | ||
if (result.ContentStream.Length == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to check result.ContentStream is null first? as it can be a Stream?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Description
fix when remove artifact, responseContent?.ToString() throw exception ArgumentNullException
Mandatory Checklist
Please choose the target release of Azure PowerShell. (⚠️ Target release is a different concept from API readiness. Please click below links for details.)
Check this box to confirm: I have read the Submitting Changes section of
CONTRIBUTING.md
and reviewed the following information:ChangeLog.md
file(s) appropriatelysrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
.## Upcoming Release
header in the past tense.ChangeLog.md
if no new release is required, such as fixing test case only.