When job is failed im not getting exception screenshot message instead im getting some error message in orchestrator

When job is failed im not getting exception screenshot message instead im getting some error message in orchestrator so how to fix this issue

Exception details in orchestrator mentioned below
System.ComponentModel.Win32Exception (0x80004005): The handle is invalid
at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
at System.Drawing.Graphics.CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
at UiPath.Vision.UiImage.FromScreenRegion(Rectangle region)
at UiPath.Core.Imageā€¦ctor(Region screenRegion)

UiPath.Core.ImageOperationException: System.ComponentModel.Win32Exception (0x80004005): The handle is invalid
at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
at System.Drawing.Graphics.CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
at UiPath.Vision.UiImage.FromScreenRegion(Rectangle region)
at UiPath.Core.Imageā€¦ctor(Region screenRegion) ā€”> System.ComponentModel.Win32Exception: The handle is invalid at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
at System.Drawing.Graphics.CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
at UiPath.Vision.UiImage.FromScreenRegion(Rectangle region)
at UiPath.Core.Imageā€¦ctor(Region screenRegion)
ā€” End of inner exception stack trace ā€”
at UiPath.Core.Activities.ObsoleteTaskAsyncCodeActivity`1.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)

@Sathish_Kumar5,

Are you using ReFramework? If yes then it should work if not then you will have to add/develop logic for the screenshot.

Thanks,
Ashok :slight_smile:

only using normal workflowā€¦ Actually, I did add the logic for taking screenshot it works fine for some time but sometimes Iā€™m getting this error.

Could you please share a screenshot of how you implemented the Screenshot part in your workflow?


image

below that i used delete folder acrivity

@Sathish_Kumar5,

The screenshot should be passed to queueItem while Setting the transaction status like this in Details property of Set Transaction Status.

Thanks,
Ashok :slight_smile:

This is not reframe work code so can you suggest me something else pls

@Sathish_Kumar5, even though you are not using ReFramework, if you are using Queue then this way you can add screenshot filepath to the exception.

If you are not using Queue Items then you can save the screenshot on Shared drive and add that path into log and refer later for debugging purpose.

Thanks,
Ashok :slight_smile:

1 Like

ok i get it but i want exception message that in mail and why i cant get it some times i also added exception in below also mentioned in post

Exception details in orchestrator mentioned below
System.ComponentModel.Win32Exception (0x80004005): The handle is invalid
at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
at System.Drawing.Graphics.CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
at UiPath.Vision.UiImage.FromScreenRegion(Rectangle region)
at UiPath.Core.Imageā€¦ctor(Region screenRegion)

UiPath.Core.ImageOperationException: System.ComponentModel.Win32Exception (0x80004005): The handle is invalid
at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
at System.Drawing.Graphics.CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
at UiPath.Vision.UiImage.FromScreenRegion(Rectangle region)
at UiPath.Core.Imageā€¦ctor(Region screenRegion) ā€”> System.ComponentModel.Win32Exception: The handle is invalid at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
at System.Drawing.Graphics.CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
at UiPath.Vision.UiImage.FromScreenRegion(Rectangle region)
at UiPath.Core.Imageā€¦ctor(Region screenRegion)
ā€” End of inner exception stack trace ā€”
at UiPath.Core.Activities.ObsoleteTaskAsyncCodeActivity`1.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)

@Sathish_Kumar5,

For that you can use exceptionVariable.Message to get message of the exception but I would suggest itā€™s not the best practice. The exception message could be sometimes not sufficient to understand the issue.

Best practice would be attach screenshot to email and attach execution log text file as well to email.

Thanks,
Ashok :slight_smile:

Yeah, thatā€™s good idea but Iā€™m not getting any exception message sometime in mail so that is my concern.

@Sathish_Kumar5,

Thatā€™s odd because there would be Message always for each exception. Couldnā€™t think of any possible reason for that but, you can use attaching execution log to email as fallback mechanism. This way even mail body misses the error message, your execution log will have it.

Thanks,
Ashok :slight_smile:

Hi, regarding the error ā€œThe handle is invalidā€, can you please look at this post and see if it solves your issue?

Also, for what concerns the fact that youā€™re getting the error message in Orchestrator, what I suspect is the following:

  • An exception is raised
  • Your Catch block catches the exception
  • Your Catch block takes the screenshot
  • Your Catch block throws an exception ā€œThe handle is invalidā€ while taking the screenshot and as thereā€™s no tryā€¦catch block around the Take Screenshot activity then the exception is simply thrown right away.

So, either you fix the root cause of the exception that is thrown by the Take Screenshot activity, or you put a tryā€¦catch block around the Take Screenshot activity.

1 Like

Thanks for suggestions sure ill try and let you know