Skip to content

Commit 155b6ef

Browse files
kevinzz6Copilot
andauthored
[Synapse]fix remove artifact throw exception ArgumentNullException (#28123)
Co-authored-by: Copilot <[email protected]>
1 parent 85212eb commit 155b6ef

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/Synapse/Synapse/ChangeLog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
-->
2020

2121
## Upcoming Release
22-
22+
* Fixed an error when remove artifact throw `ArgumentNullException`
2323
## Version 3.2.1
2424
* Fixed an error of not correctly setting the cmdlet context
2525

src/Synapse/Synapse/Common/Utils.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,14 @@ public static Response Poll(this Operation operation)
239239
{
240240
var result = operation.WaitForCompletionResponseAsync().Result;
241241
var responseContent = result.Content;
242-
243-
if (responseContent?.ToString() != "{}" && responseContent?.ToString().IsEmptyOrWhiteSpace() == false)
244-
{
245242

243+
//Fix when responseContent.length is 0 responseContent?.ToString() will throw exception ArgumentNullException
244+
if (result.ContentStream == null || result.ContentStream.Length == 0)
245+
{
246+
return result;
247+
}
248+
else if (responseContent?.ToString() != "{}" && responseContent?.ToString().IsEmptyOrWhiteSpace() == false)
249+
{
246250
throw new Exception(responseContent?.ToString());
247251
}
248252
return result;

0 commit comments

Comments
 (0)