为什么得到“文件被另一个进程使用"?在Visual Studio中调试时出现错误?

编程入门 行业动态 更新时间:2024-10-27 21:25:01
本文介绍了为什么得到“文件被另一个进程使用"?在Visual Studio中调试时出现错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

使用Visual Studio 2010 beta,当我在IDE中运行我的应用程序进行调试时,它在第一次运行时就完美运行了.但是,在关闭调试会话后(通过关闭应用程序或单击停止调试"按钮),所有随后的调试应用程序的尝试均将失败,并显示以下信息:

Using Visual Studio 2010 beta, when I run my application within the IDE for debugging, it works perfectly the first time. However, after closing the debug session, either by closing the application or clicking the stop debugging button, all subsequent attempts to debug the application fail with:

错误1无法复制文件"obj \ Debug \ Application.dll" 到 "bin \ Debug \ Application.dll". 进程无法访问文件 'bin \ Debug \ Application.dll' 因为它被另一个人使用 过程.

Error 1 Unable to copy file "obj\Debug\Application.dll" to "bin\Debug\Application.dll". The process cannot access the file 'bin\Debug\Application.dll' because it is being used by another process.

SysInternals的

Handle.exe确实显示了句柄打开,但是即使我关闭了句柄,错误也不会消失.手动删除文件的任何尝试都会导致访问被拒绝"错误消息.

Handle.exe from SysInternals does show handles open, but even if I close the handles, the error doesn't go away. Any attempts to delete the file manually result in an "Access Denied" error message.

要解决此问题,我必须完全重新启动Visual Studio,此后,调试会话将运行一次,然后再次停止.

To fix this, I have to completely restart Visual Studio, afterwhich the Debug session will work once and stop again.

我不确定这是何时开始的,但是我很确定这是最近的事情.

I'm not entirely sure when this started happening, but I'm pretty sure it's fairly recently.

更新:在我强制关闭Application.dll的句柄之后,我从VS中收到以下错误:

UPDATE: After I force close the handles on Application.dll, I get the following error from VS:

错误1无法复制文件 "obj \ Debug \ Application.dll" 到 "bin \ Debug \ Application.dll". 请求的操作不能是 在具有用户映射的文件上执行 部分打开.

Error 1 Unable to copy file "obj\Debug\Application.dll" to "bin\Debug\Application.dll". The requested operation cannot be performed on a file with a user-mapped section open.

用户映射部分"到底是什么?

What the heck is a "user-mapped section"??

更新2 :当我在尝试调试时在设计"视图中打开窗体时,似乎会出现此问题.我将做更多的故障排除,然后发布结果.

UPDATE 2: It appears that this problem occurs when I have a Form open in Design view when trying to debug. I'm going to do some more troubleshooting and then post my results.

更新3 :我认为我已经使用UserControl将其缩小为一种形式.

UPDATE 3: I think I've narrowed it down to a form using a UserControl.

推荐答案

老实说,这听起来像是VS2010中的错误.由于某种原因,它在调试器停止时不会关闭打开的句柄.终止VS进程会自动关闭这些句柄,从而使您可以再次访问该文件.作为一种变通方法,您可以查看 unlocker ,它是免费的,并且运行异常良好.我知道这不是一个很好的答案,但是它应该比重新启动VS更快.您可能也考虑发送错误报告...

To be honest with you, it sounds like a bug in VS2010. For some reason it isn't closing the open handles when the debugger stops. Killing the VS process automatically closes those handles, allowing you to access the file again. As a work around, you might look at unlocker it's free and works exceptionally well. I know that's not a great answer, but it should be faster than restarting VS. You might to consider sending a bug report too...

Unlocker在64位操作系统上不起作用,但 LockHunter 可以.

Unlocker doesn't work on 64-bit OS, LockHunter does though.

更多推荐

为什么得到“文件被另一个进程使用"?在Visual Studio中调试时出现错误?

本文发布于:2023-08-07 10:44:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1318689.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:出现错误   进程   文件   quot   Studio

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!