Exception while saving a Image


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)

HI @abhinav_kaushal,

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


Hi, did you get the issue and able to solve it? I’m also getting the same issue when try to take screenshot in exception (step status) using reporter activities package. If so please do help me out

Hi @abhinav_kaushal ,

Please read the error message properly, its clearly says file path issue.

Prakash M