Not able to move files while using load image activity

Hey Guys!

Wassup?

Have a small challenge for you,

Attaching a zip file which has a work flow containing a image with sample work flow.

if u run this file you will get a error like “The process cannot access the file because it is being used by another process”

i want to move this file to a newly created folder.

Note: Even i am trying for this to get done, if any one helps it will be a great help for me in time saving😊

Thanks in advance…!!!LoadImage.zip (188.7 KB)

@harsha1123 - When you run the Main.xaml, please make sure that the file “syntel letter pad.jpg” is not open in your laptop/desktop. This error comes up when your process is trying to access the file which is already open.

Hey @sreenivasm,

I have checked everything, the only thing i have to do is dispose the file which is current file.

Thank for your quick response.

hey @ovi

I have found this bug in my project, which i need to get this done in a day, i have tried with all my colleagues still did no get solved.

Please let me know if we can we do this use case with uipath.

Thanks in advance and sorry for mentioning you in this post

Hey Guys,

how’s everything going on…?:-:slightly_smiling_face:

Have a doubt regarding load image activity…

I’m using load image activity to load the image and passing through a OCR after that comparing the text i have to move that file to some folder…

I’m able to scan and compare the data but not able to move the file.

getting error like this file is used by another process can’t move

any help would be appreciated.

Hi @harsha1123

You might want to check this out for some hint:

You can try using the Invoke Method activity to call the Dispose method on your image to free up the file.

Hey thanks for your reply, can u please check this post once

Hey there.
I have same issue.

img.Dispose(), even set img=Nothing and load another image does not help
Strangely but it works fine in debug mode (F7).
When I run same code (F5) it throws exception on deleting image file. Delay doesn’t help.

Hi @Yuri

Could you post your project example? I can’t seem to reproduce it working in debug mode.
(I joined the topics for clarity)

Hi, @loginerror

Here you can get example, and video.
I simplified code as much as possible, but bypassing error in debug mode very unstable and this code can throw exception with every little edit (even if I put OCR outside of additional sequnce).

Looks like every use of image make a lock for image file: if I delete OCR - it works fine even I run code, not only in debug.

I use win10 1803, Studio CE stable 2019.1.0

I also face the same problem in using the load image activity. Instead, try to use rotate image with zero degree rotation and it works fine.

1 Like

Hi @Yuri @YUSL @harsha1123

See here for a working solution :slight_smile:

I love how our users will eventually figure out everything :smiley:

I adapted your example with these additional Invoke Methods and it worked without an issue.

2 Likes

Uh… Yeah, I resolved the problem same way, using GC.Collect, thanks to UiPath tech support.
Just completely forgot about this topic.

Just one note, I made some research and it seems that in most cases GC.Collect is enough for release image file.
GC.WaitForPendingFinalizers in general is rather slow and in some cases may cause dead lock so it’s recommeneded not to use it if it’s not necessary.

1 Like