unable to run solution from within studio more than once

Ask general questions here.
martinsw
Posts: 72
Joined: Fri Dec 09, 2011 2:48 pm

unable to run solution from within studio more than once

Post by martinsw » Wed Jan 18, 2012 1:44 pm

Dear Ranorex,

When I open Ranorex studio for the first time and then run my solution, the solution runs as expected. However when I try to run the same solution a second time from within studio I get an error message which says:

“Unable to copy file "obj\x86\Release\\<SolutionName>.exe" to "bin\Release\\<SolutionName>.exe". The process cannot access the file 'bin\Release\<SolutionName>.exe' because it is being used by another process. (MSB3021)”

I can’t see anything in my task manager to indicate a process that was not properly closed. Currently, the only workaround I have is to close Ranorex studio, re-open it and then run the solution.

This problem does not occur when I run the solution outside of Ranorex studio from the bin folder – In this scenario I can run the solution multiple times with no error.

My solution currently has a lot of data driven tests, the source of which is an excel spreadsheet (not sure if this is relevant).

Please let me know if you need any more information. I have attached a screenshot of the error along with a screenshot of my task manager running processes taken after the solution has run for the first time.
Attachments
taskmanager.jpg
taskmanager.jpg (74.32 KiB) Viewed 2031 times
error.jpg
error.jpg (48.86 KiB) Viewed 2031 times

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: unable to run solution from within studio more than once

Post by Ciege » Wed Jan 18, 2012 4:37 pm

From within the Studio IDE, are you making any code changes between runs (i.e. a successful run, code change, then try to run again)?
Are you using any InvokeRemotely calls in your code?

Similar errors can occur when using InvokeRemotely. When you run your code once the Invoke makes a connection to a DLL that does not close when the test is completed. If you then make a code change in your automation code and try to save or re-run the test (which causes a rebuild and a save) the DLL will be locked causing an error when the project needs to re save. You should be able to close your AUT then be able to build and re-run your test.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

martinsw
Posts: 72
Joined: Fri Dec 09, 2011 2:48 pm

Re: unable to run solution from within studio more than once

Post by martinsw » Mon Jan 23, 2012 1:55 pm

Hi,

The error occurs both when I make changes in between runs and also when I make no changes in between runs. I have created a basic configuration which logs the user into the web client and then logs the user out again. Even with this basic test I am still only able to run it once within Studio. On the second occasion I get the error message mentioned below. Closing and re-opening studio in between every run is not practical but its the only workaround I have currently.

I am not a C# programmer. I am a tester using the studio tools to create automated tests so I'm not sure whether or not i'm using any InvokeRemotely calls in the code. It's possible that I am when I create my test cases using the tools.

If you want me to email a copy of my solution over to you then I am happy to do so as this is something I'd really like to stop from happening! :D

Thanks, Martin

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: unable to run solution from within studio more than once

Post by Ciege » Mon Jan 23, 2012 4:01 pm

martinsw wrote: If you want me to email a copy of my solution over to you then I am happy to do so as this is something I'd really like to stop from happening!
I'll let you do that with the support team... I was just offering some possible reasons that this could be happening but it looks as if they may need to get involved a little further with you than just my cursory suggestions...
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: unable to run solution from within studio more than once

Post by Support Team » Mon Jan 23, 2012 4:21 pm

Hi,
martinsw wrote:I am not a C# programmer. I am a tester using the studio tools to create automated tests so I'm not sure whether or not i'm using any InvokeRemotely calls in the code. It's possible that I am when I create my test cases using the tools.
As ciege already suggested, normally this only occurs if you use an invoke remotely. Did you try to search your entire solution for the keyword "invoke"? Did you try to delete the related exe with the Windows Explorer? Maybe the explorer tells you which program locks your file. Otherwise you could use the ProcExp from Sysinternals to check which object locks your exe
http://technet.microsoft.com/en-us/sysi ... s/bb896653

Regards,
Peter
Ranorex Team
.
Image

solovengo
Posts: 24
Joined: Mon Dec 19, 2011 8:14 pm

Re: unable to run solution from within studio more than once

Post by solovengo » Wed Feb 29, 2012 10:40 pm

I am also seeing this same error. I am using Ranorex 3.2.1.

I have searched all files in my solution for InvokeRemotely, but no matches were found.

I have used ProcExp to attempt to discover if the project's Exe mentioned in my error is in use by another app. It is not is use anywhere.

I don't know why it would matter, but the Solution is on a network share, not on the machine where Ranorex is installed. If I copy the solution to the machine where Ranorex is installed, this error does not occur.

I have used the workaround that martinsw suggested... closing Ranorex and restarting it. Closing the Solution and reopening the Solution does not help. Ranorex must be restarted to release the .exe.

Please let us know if you have any other ideas what might be causing this error.

Thanks!

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: unable to run solution from within studio more than once

Post by Support Team » Thu Mar 01, 2012 10:25 am

solovengo wrote: I don't know why it would matter, but the Solution is on a network share, not on the machine where Ranorex is installed. If I copy the solution to the machine where Ranorex is installed, this error does not occur.
It looks like you might have some .Net framework regarding security problems.
You either can try to run you solution with .Net framework 2.0 by removing .Net 4.0 framework as supported runtime from the app.config file of your project.
Or you can try to give your network drive full trust as described in following link:
Giving a Mapped Drive .NET FullTrust

Regards,
Tobias
Ranorex Team
.
Image