Exception while saving a Image


#1

Hi

When a exception occurs my code takes a screenshot and saves the image in a given folder in “png format” but sometimes I am receiving the below mentioned error:

UiPath.Core.ImageOperationException: Save image failed. Check if the file name is a valid path —> System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(String filename, ImageFormat format)
at UiPath.Core.Image.SaveFile(String fileName)
— End of inner exception stack trace —
at UiPath.Core.Activities.InvokeWorkflowFile.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)


#2

HI @abhinav_kaushal,

Please refer the xaml file.
Give the valid path to save the image
saveimage.xaml (7.9 KB)

Regards,
Arivu