Skip to content

[Synapse]fix remove artifact throw exception ArgumentNullException#28123

Merged
YanaXu merged 6 commits into
Azure:mainfrom
kevinzz6:Fix-synapse-remove-artifact-issue
Jul 3, 2025
Merged

[Synapse]fix remove artifact throw exception ArgumentNullException#28123
YanaXu merged 6 commits into
Azure:mainfrom
kevinzz6:Fix-synapse-remove-artifact-issue

Conversation

@kevinzz6
Copy link
Copy Markdown
Contributor

@kevinzz6 kevinzz6 commented Jul 3, 2025

Description

fix when remove artifact, responseContent?.ToString() throw exception ArgumentNullException

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Copilot AI review requested due to automatic review settings July 3, 2025 05:43
@azure-client-tools-bot-prd
Copy link
Copy Markdown

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

Copy link
Copy Markdown
Contributor

Copilot AI left a 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)

Comment thread src/Synapse/Synapse/Common/Utils.cs Outdated
Comment thread src/Synapse/Synapse/Common/Utils.cs
kevinzz6 and others added 2 commits July 3, 2025 13:44
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment thread src/Synapse/Synapse/Common/Utils.cs Outdated
{

//Fix when responseContent.length is 0 responseContent?.ToString() will throw exception ArgumentNullException
if (result.ContentStream.Length == 0)
Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@YanaXu
Copy link
Copy Markdown
Contributor

YanaXu commented Jul 3, 2025

/azp run

@azure-pipelines
Copy link
Copy Markdown
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@YanaXu
Copy link
Copy Markdown
Contributor

YanaXu commented Jul 3, 2025

/azp run

@azure-pipelines
Copy link
Copy Markdown
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

Comment thread src/Synapse/Synapse/ChangeLog.md
@YanaXu
Copy link
Copy Markdown
Contributor

YanaXu commented Jul 3, 2025

/azp run

@azure-pipelines
Copy link
Copy Markdown
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@YanaXu YanaXu merged commit 155b6ef into Azure:main Jul 3, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants