I've upgraded my Windows to 10.0.16299 (latest) and my Visual Studio to 15.5.1 (latest). Since then, I am seeing this error message when I clean or build my Xamarin solution containing an Android project:
obj\Debug\android\src\android\support\customtabs\CustomTabsClient_CustomTabsCallbackImpl.java:4:
error: error while writing CustomTabsClient_CustomTabsCallbackImpl:
obj\Debug\android\bin\classes\android\support\customtabs\CustomTabsClient_CustomTabsCallbackImpl.class
(The process cannot access the file because it is being used by
another process)
I figured that the locking process is Visual Studio itself after I tried to run and debug the app.
The issue appears no matter whether I want to run the app on an emulator or a connected real device.
There's lots of advice what to do when a process locks a file including SO such as the famous the process cannot access the file because it is being used by another process. However, all provided answers don't help as Visual Studio itself locks the file and the only workable workaround is to restart Visual Studio - that's not a solution.
What is causing this file to be locked? Any idea? Any advice?
Sometimes it helps to kill the MsBuild.exe. Also, you could find other solutions such as described here: Xamarin Android project cannot build....
Basically, it seems to be a problem with Studio 2017 Version 15.5. It will be fixed with the next versions probably.
Darn it, my suggestions won't fit in the context of a comment, so here goes:
Sounds like the process being debugged, or the emulator hosting the debugged process, itself, has not fully closed down, and is in a hung or semi-hung state. Have you checked the process manager to see if this is the case? You may want to to try adding Environment.Exit() to see if this helps come back to a good state.
Another thing to check is, whether your access levels are the same between the two machines. Check not only the PC, but also at the emulator as well. Check everything, and ensure the access levels/modes are identical.
Finally, try running VS 2017 in administrator mode, and see if the problem persists. It's entirely possible that the level of access that you used to run pre-Windows 10 is different in the Win10 world that you live in, now.
Related
I have a problem in my visual studio or my computer that I can't figure out how to solve.
This is the situation:
I wrote a program and when I tried to run it from the .exe file, it didn't work. From debug, the program worked properly but if I tried to open a second instance of it, it didn't work.
In both cases, when I opened the second instance, or open the .exe file, the process of the program opened and didn't work (kept loading, or in the second debug instance case it got the VS stuck). When I tried to close the process I couldn't, even after closing visual studio task. The only way was to restart my PC, witch I did a lot.
After that, I tried to run the program on another computer and I found out it worked well.
I came back to my PC to try to solve the problem. I uninstalled VS13 and installed instead the VS15.
I opened a new WPF project. First thing i did was build it and open the .exe and it still didn't open!
This is my case guys. I would love to hear information on this problem, why it happend and how to solve it.
My PC is running Win 8.1 pro x64 operating system.
I found this that resembles my case:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/fbae61b4-47f1-4074-9261-505ebbd8d459/cant-run-visual-studio-2012-generated-exe-files?forum=vcgeneral
Thanks!
The soultion to my problem was simple, i can't believe i didn't thought of it before. thanks to the first comment.
Disabling avast anti-virus solve the problem, the exe of my new and my original program is working fine.
Now all i need to do is find a way to make it work with the anti-virus working.
I'm working on an ASP.NET Web Forms application (.NET 4.0 VS 2010). Lately we've been experiencing problems which have halted our release process.
Specifically, we have found ourselves unable to publish our website (to precompile it). Across all of our developer environments (3 developers), the build process appears to be stalling/hanging - without any report of error. Sometimes, it appears to succeed but only a couple of the compiled DLL's and .compiled files appear (less than 10 out of ~350 files).
I've loaded in various revisions of our projects from our source repository, both latest and very old versions which previously worked. The fact that it's happening across developer environments suggested that the problem was due to some change we committed, but the fact that the problem is occurring across latest and old revisions of the application perhaps suggest otherwise.
Internet searches for this issue reveal nothing significant. Things I've tried include the following:
Building and rebuilding
Clean solution
Deleting the .suo files for the solution
Deleting the contents of the ASP.NET Temporary Files solution and deleting the target location folder prior to publishing
Tried selecting the 'Allow this precompiled site to be updateable' option (produces an object reference error without a file or line number)
Restarting Visual Studio and PC
On examination of CPU usage during the build, the CPU usage for the devenv.exe process is in the sub 0.10% area for most of it (a few spikes at the beginning just).
I appreciate any assistance anyone can provide with this
UPDATE: We have found that eventually, the publish succeeds, but sometimes we get a long series of failures before it succeeds. There's no consistency at all... it seems random.
I had this same issue with Visual Studio 2015 on Server 2016. The issue was partially resolved by running VS as administrator. However the apparent root cause was virus scan - in this case ESET- installed not as a File Security but as workstation. This I discovered when every entry of the license codes for ESET appeared to work - then ESET reported it still required verification. Uninstalled the badly chosen ESET and reinstalled the correct license product and, presto, with or without pre-completion, the publish works! Thanks to the previous virus scan tip!
The issue seems to have been caused by the McAfee virus-scanning software that we have installed.
Only with admin privileges, we were able to temporarily disable the real-time scanning, and as soon as we done that the ASP.NET Publish would complete successfully almost instantly.
For anyone else in this situation, it was McAfee's anti-virus software that was causing the problem. I checked the logs for the anti-virus software and there was no evidence that the software was blocking anything related to the Visual Studio processes or the folders that are manipulated during the build and publish processes (e.g. The ASP.NET temporary files folder).
Specifically, the csc.exe (C# compiler) and devenv.exe (Visual Studio) processes were having problems with McAfee. These processes were added as 'Low-Risk Processes' to the 'On-Access Scanner' to resolve the problem.
McAffee removes any changes to it's settings every 15 minutes, meaning that the action of adding these processes to the McAfee exception list (low-risk processes) has to be repeated every 15 minutes when you are building your code. This could happen a lot during a working day.
I see you do not have Allow this precompiled site to be updatable checked, so your Publish may be attempting to update what it thinks has changed.
Try deleting all the files (copy existing files to a new location or rename the folder, if you want), and try your Publish again.
I develop C# applications using VS 2010 Ultimate.
Usually, those applications run for long time, without user interaction and, of course, they usually have bugs inside.
Unfortunately, often the application crashes randomly and you just can't reproduce the error. Also sometimes I only have the message "The application has stopped working" with no more informations.
I can install Visual Studio on the machine of the customer, but I can't let him run VS and compile/start the source code in debug mode! What I need is to start VS after the application was started and crashed. It seems to be possible to do this, in fact when an exception happens at runtime, Windows ask you "do you want to debug with VS?", but if I answer YES, then VS starts but simply I can't see the source code (it is on the pc as well), thus I can't inspect the row of code that is causing the exception. VS just tells me "source code not available". Actually, I can't imagine how Windows could start VS and know where the source code of the crashed application is!
Does anyone knows how does this debugging scenario is intended to work, and how to configure it??
Thanks a lot,
Simone
Windbg debugging tool solves the purpose.
Take dump of the process state and start analyzing with windbg. It gives you the exception information
To debug from an already-running Visual Studio instance, select the "Debug" menu item, then "Attach to Process..."
Next, select the executable from the list, press "Attach" (or double-click), and you are now debugging the application. When you select "Yes" and Windows says that source code is not available, this most likely means that the PDB wasn't able to be loaded, so make sure that you have loaded the symbols for the module by examining it in the "Modules" window pane.
If you want to catch errors while running compiled program, you should use some sort of logging mechanism. These days you don't have to write it on your own, there's a great opensource logging engine designed for .NET applications, it's called NLog. It's capable of saving logs into files, emails, console or database, pretty much all you can want :).
Hope this helps :)
I'm having the exact same problem as outlined in this post:
Could not launch xxx.exe. Previous attempt to profile the application finished unsuccessfully. Please restart the application
All the Profiling methods give the same error on my system. The type of project I'm trying to profile is XNA/C#.
The provided solution to that problem is the only solution I can find using Google but it does not apply to me as I do not have Symantec anti-virus. Also, there are no instances of the SysPlant registry key (as mentioned in the above link) on my system. I have tried disabling all anti-malware and anti-virus software on my system but still get the error. Does anyone else have any other suggestions?
I had this issue, yet bizarrely it only affected one Visual Studio solution. Using the profiler with another Visual Studio solution worked fine.
I tried:
disabling Symantec
uninstalling VMware Player
but neither worked.
In the end I amended the registry, setting HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SysPlant\Start to 4 and rebooted, it then started working.
I have a program that I built that reads and writes files. I built it in Release mode, then tried to run the exe on Win7. At first, with troubleshooting on, Windows simply told me the application closed and it was looking for a solution. After a few seconds, the dialog would disappear and show nothing more.
So with some significant effort I got the debugger attached to the process, but it was only showing me disassembly, which tells me that the error taking place wasn't in my application code, but in the framework somewhere.
The strange thing is that when I let the debugger attach, then press "stop" in VS, and exit the debugger, the program actually runs at that point!
So now I'm stumped. I have an application that builds, that seems to be having a permission error when I run it, but if I let the debugger attach then close it, it runs, and there's no Exception to really look at.
How I troubleshoot this issue?
Edit: Responding to Merlyn:
It's a custom app written from scratch in c#. The only dependency it has outside of core .NET namespaces is the Ionic.Zip DLL.
Visual Studio 2008 (Writing in C# 3.5)
Windows 7 - Home Premium, v6.1 build 7600
CPU - x64 quad core
CPU are you compiling under: Any CPU
I haven't tried it on another machine or a different version of VS.
Edit: I was able to try the compiled version on another win7 computer, and it worked without issue, so it looks like a security (?) issue on my computer only.
Try it in the debugger with Just My Code disabled and Native Code enabled, then check the call stack.
Also, what happens if you run it directly in Visual Studio?
Uncheck Enable Visual Studio Hosting Process in Project Properties and see whether it still works in VS.
I'd suggest sending the issue to Microsoft support. Especially with the data given here, you will have an easy time convincing them it's their problem. You might need an MSDN subscription for that.