[Synapse]fix remove artifact throw exception ArgumentNullException#28123
Merged
Conversation
| Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status. |
Contributor
There was a problem hiding this comment.
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 == 0to 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 <175728472+Copilot@users.noreply.github.com>
…m/kevinzz6/azure-powershell into Fix-synapse-remove-artifact-issue
wanyang7
reviewed
Jul 3, 2025
| { | ||
|
|
||
| //Fix when responseContent.length is 0 responseContent?.ToString() will throw exception ArgumentNullException | ||
| if (result.ContentStream.Length == 0) |
Member
There was a problem hiding this comment.
better to check result.ContentStream is null first? as it can be a Stream?
Contributor
|
/azp run |
Contributor
|
Azure Pipelines successfully started running 3 pipeline(s). |
Contributor
|
/azp run |
Contributor
|
Azure Pipelines successfully started running 3 pipeline(s). |
wanyang7
reviewed
Jul 3, 2025
wanyang7
approved these changes
Jul 3, 2025
Contributor
|
/azp run |
Contributor
|
Azure Pipelines successfully started running 3 pipeline(s). |
YanaXu
approved these changes
Jul 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.mdand reviewed the following information:ChangeLog.mdfile(s) appropriatelysrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.## Upcoming Releaseheader in the past tense.ChangeLog.mdif no new release is required, such as fixing test case only.