-
May 12th, 2024, 06:34 AM
#1
Thread Starter
Fanatic Member
vs2022 locked file again, this time not on opening a file
Last time I had to reboot PC to remove the lock and then delete the files in debug folder
Simply was playing with a listview in a tiny project
Code:
Severity Code Description Project File Line Suppression State
Error Could not copy "obj\Debug\FontTestVS2008.exe" to "bin\Debug\FontTestVS2008.exe". Exceeded retry count of 10. Failed. The file is locked by: "FontTestVS2008.exe (24800)" FontTestVS2008
Code:
Severity Code Description Project File Line Suppression State
Error Unable to copy file "obj\Debug\FontTestVS2008.exe" to "bin\Debug\FontTestVS2008.exe". The process cannot access the file 'bin\Debug\FontTestVS2008.exe' because it is being used by another process. FontTestVS2008
I doubt related to this sub here. I had halted on a breakpoint.
Pressed F8 multiple times, then pressed F11 to step and was getting exception errors for invalid index.
Hit cntrl brake several times. while it was sitting at a brakepoint
Then stopped program in the IDE and now it is locked.
Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim i, j As Integer
Dim LItem As ListViewItem
For i = 0 To ListView1.Items.Count - 1
LItem = ListView1.Items(i)
Debug.Print(LItem.Text)
For j = 0 To LItem.SubItems.Count - 1
' Debug.WriteLine(" " & ListView1.Columns(1).Text & " " & LItem.SubItems(0).Text)
Next
Next
End Sub
-
May 12th, 2024, 06:40 AM
#2
Thread Starter
Fanatic Member
Re: vs2022 locked file again, this time not on opening a file
shut down vs2022, restart vs2022, reopen project, tried to run it
File is locked by itself?
What is this saying?
Code:
Severity Code Description Project File Line Suppression State
Warning Could not copy "obj\Debug\FontTestVS2008.exe" to "bin\Debug\FontTestVS2008.exe". Beginning retry 8 in 1000ms. The process cannot access the file 'bin\Debug\FontTestVS2008.exe' because it is being used by another process. The file is locked by: "FontTestVS2008.exe (24800)" FontTestVS2008
-
May 12th, 2024, 06:49 AM
#3
Thread Starter
Fanatic Member
Re: vs2022 locked file again, this time not on opening a file
This time I am really stuck.
Deleted all bin and obj folders in the project and still get same error
Going to reboot PC and try again
-
May 12th, 2024, 07:33 AM
#4
Re: vs2022 locked file again, this time not on opening a file
Do you have Process Explorer? https://learn.microsoft.com/en-us/sy...ocess-explorer
Is there more than one entry with different PIDs?
-
May 12th, 2024, 08:32 AM
#5
Thread Starter
Fanatic Member
Re: vs2022 locked file again, this time not on opening a file
yes, a reboot and it can run again.
-
May 12th, 2024, 08:57 AM
#6
Re: vs2022 locked file again, this time not on opening a file
Your "FontTestVS2008.exe" file was still running in the background. You should be checking Task Manager and terminate it from there.
Some older compiler that I used in the past would have a note of something to the effect of "Is it still running?" along with this error message, as a reminder to the programmer that you need to close all previous running instances of the .exe before it can be rebuilt.
-
May 12th, 2024, 08:59 AM
#7
Thread Starter
Fanatic Member
Re: vs2022 locked file again, this time not on opening a file
 Originally Posted by OptionBase1
Your "FontTestVS2008.exe" file was still running in the background. You should be checking Task Manager and terminate it from there.
Some older compiler that I used in the past would have a note of something to the effect of "Is it still running?" along with this error message, as a reminder to the programmer that you need to close all previous running instances of the .exe before it can be rebuilt.
I thought the same thing, but I looked and the only thing running was vs2022, and under it "FontTestVS2008.exe"
I think when I ended that process, all of VS2022 shut down/
-
May 12th, 2024, 09:52 AM
#8
Thread Starter
Fanatic Member
Re: vs2022 locked file again, this time not on opening a file
Since I deleted all EXE named that fonttestvs2008.exe and Debug and Release folders related to the little project, I notice, it loads and runs fine, but no exe files are made anymore.
How can I make an EXE file again?
EDIT,
I found it.
I make a copy if I do anything first in vs2008 as vs2022 does a one way conversion to the project.
Which I assume means it will never work in vs2008 again.
And I use the copy folder to run vs2022, and the EXE is there.
Last edited by sdowney1; May 12th, 2024 at 10:01 AM.
-
May 20th, 2024, 08:39 AM
#9
Thread Starter
Fanatic Member
Re: vs2022 locked file again, this time not on opening a file
Locked again.
Severity Code Description Project File Line Suppression State
Error Could not copy "obj\Debug\FontTestVS2008.exe" to "bin\Debug\FontTestVS2008.exe". Exceeded retry count of 10. Failed. The file is locked by: "FontTestVS2008.exe (25656)" FontTestVS2008
All I did was add this savedialog checkfileexists line, then clicked the start button, and LOCKED
Code:
If SaveFileDialog1.ShowDialog() = DialogResult.OK Then 'user selected a file name
If SaveFileDialog1.CheckFileExists = True Then Text2.Text = SaveFileDialog1.FileName
'If SaveFileDialog1.FileName <> "" Then Text2.Text = SaveFileDialog1.FileName
Exit Sub
End If
And again, task manager shows only vs2022 with fonttest2008 under it, and when I click to end fonttest2008, vs2022 will stop responding, blanks out. Then have to force exit vs2022 in task manager.
-
May 20th, 2024, 08:48 AM
#10
Re: vs2022 locked file again, this time not on opening a file
Are you running any threads in this application? The code you have shown seems unlikely to be the cause of the problem, as you noted, but if you have any threads, it is possible to leave them running when the application otherwise seems to be shut down.
My usual boring signature: Nothing
 
-
May 20th, 2024, 08:57 AM
#11
Re: vs2022 locked file again, this time not on opening a file
The second line here doesn't make sense:
Code:
If SaveFileDialog1.ShowDialog() = DialogResult.OK Then 'user selected a file name
If SaveFileDialog1.CheckFileExists = True Then Text2.Text = SaveFileDialog1.FileName
It looks to me that you think CheckFileExists works differently than it actually does. It's a property that you set before calling ShowDialog. There's no reason for you to be checking it after ShowDialog returns. I suggest that you read the documentation for that property to learn what it actually does and experiment a bit using it properly.
-
May 20th, 2024, 09:25 AM
#12
Re: vs2022 locked file again, this time not on opening a file
 Originally Posted by sdowney1
Locked again.
All I did was add this savedialog checkfileexists line, then clicked the start button, and LOCKED
Code:
If SaveFileDialog1.ShowDialog() = DialogResult.OK Then 'user selected a file name
If SaveFileDialog1.CheckFileExists = True Then Text2.Text = SaveFileDialog1.FileName
'If SaveFileDialog1.FileName <> "" Then Text2.Text = SaveFileDialog1.FileName
Exit Sub
End If
And again, task manager shows only vs2022 with fonttest2008 under it, and when I click to end fonttest2008, vs2022 will stop responding, blanks out. Then have to force exit vs2022 in task manager.
You should be looking in the "Details" tab of Task Manager, sort by Process name, and see if any FontTest2008.exe processes are running, and end any that are.
-
May 20th, 2024, 10:32 AM
#13
Re: vs2022 locked file again, this time not on opening a file
You shouldn't be trying to open or use files in the OBJ folder in the first placve. that is a temproary location that the compiler uses to store OBJECT files needed for the final compilation, which should be in the BIN folder... That's what you should be using... the BIN folder... NOT OBJ! What's in the OBJ folder will be half-built, and not intended for consumption.
-tg
-
May 20th, 2024, 10:47 AM
#14
Re: vs2022 locked file again, this time not on opening a file
 Originally Posted by techgnome
You shouldn't be trying to open or use files in the OBJ folder in the first placve. that is a temproary location that the compiler uses to store OBJECT files needed for the final compilation, which should be in the BIN folder... That's what you should be using... the BIN folder... NOT OBJ! What's in the OBJ folder will be half-built, and not intended for consumption.
-tg
I could be wrong but I think you've misinterpreted the error message. I think what's happening is that the EXE in the bin folder is locked so the build process cannot copy the file from the obj folder over it. I've seen this happen myself and I've also seen others report it. Sometimes it happens just once and restarting VS fixes it but sometimes it keeps happening.
If it's just one project, I'd create a new project. If it's all projects, I'd start by repairing VS.
-
May 20th, 2024, 01:54 PM
#15
Re: vs2022 locked file again, this time not on opening a file
I've seen it happen once or twice, but a restart of VS always fixed it, so I've never paid much attention to it. In this case, I'm wondering whether or not the process has really been stopped.
My usual boring signature: Nothing
 
-
May 20th, 2024, 03:15 PM
#16
Re: vs2022 locked file again, this time not on opening a file
I've had it happen a few times. Usually deleting the bin/obj folder fixes it but not always. I have had to just start an new project and add the files from the old project. Never did find an answer to why it happens. Hasn't ever happened in VS 2019 or 2022.
-
May 20th, 2024, 10:26 PM
#17
Re: vs2022 locked file again, this time not on opening a file
Yeah, I've seen it happen as a one-off at various times over the years but there was one time, some years ago, that it kept happening despite repeated restarts. Can't recall exactly what I did but I would assume that I repaired VS. That's easier than a complete uninstall and reinstall but should have the same effect, so it does mean that you'll need to set all your options again.
-
May 21st, 2024, 05:35 AM
#18
Thread Starter
Fanatic Member
Re: vs2022 locked file again, this time not on opening a file
I tried manual deleting, but it cant.
What fixes it, a reboot.
It is not a common thing, I don't know what triggers it, seems to be random.
Is it possible it could lock if code is running, sitting at a breakpoint, and you click the red stop button in the ide?
I seem to recall this time, I tried control-break multiple times, and it finally stopped as it did not want to quit running.
-
May 21st, 2024, 05:38 AM
#19
Thread Starter
Fanatic Member
Re: vs2022 locked file again, this time not on opening a file
 Originally Posted by jmcilhinney
The second line here doesn't make sense:
Code:
If SaveFileDialog1.ShowDialog() = DialogResult.OK Then 'user selected a file name
If SaveFileDialog1.CheckFileExists = True Then Text2.Text = SaveFileDialog1.FileName
It looks to me that you think CheckFileExists works differently than it actually does. It's a property that you set before calling ShowDialog. There's no reason for you to be checking it after ShowDialog returns. I suggest that you read the documentation for that property to learn what it actually does and experiment a bit using it properly.
Yes, exactly right on about what I was thinking. Will leave it out.
-
May 21st, 2024, 07:54 AM
#20
Re: vs2022 locked file again, this time not on opening a file
 Originally Posted by jmcilhinney
I could be wrong but I think you've misinterpreted the error message.
Yeah, I did misread it... I thought they were trying to run the files in the obj folder, rather than the bin one... didn't scroll all the way and missed the last half of where it was trying to copy the file to.
I'd do a repair first, and then update to see if there's been a fix released for it.
It's sounding like a VS problem though... for which there isn't much choice but to deal with it until it sorts itself out, or it's fixed somehow.
-tg
-
May 21st, 2024, 10:47 AM
#21
Re: vs2022 locked file again, this time not on opening a file
Has this problem been reported?
From VS2022 help/SendFeedback/Report a problem.
From there you can also search all reported issues.
If not already reported then you can report it.
All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
May 21st, 2024, 08:34 PM
#22
Re: vs2022 locked file again, this time not on opening a file
 Originally Posted by 2kaud
Has this problem been reported?
From VS2022 help/SendFeedback/Report a problem.
From there you can also search all reported issues.
If not already reported then you can report it.
I'm not sure that that will do any good. If you can't tell Microsoft how to reproduce an issue then they are unlikely to try to fix it and any time I've seen this or seen someone else talk about it, there never seems to be any discernible pattern.
-
May 22nd, 2024, 03:31 AM
#23
Re: vs2022 locked file again, this time not on opening a file
If you can't tell Microsoft how to reproduce an issue
They ask you to perform certain steps that produce debug/log files that you then post to them when the issue arises.
Has the reported issue database been searched to see if a similar issue has already been reported?
All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
May 22nd, 2024, 11:09 AM
#24
Thread Starter
Fanatic Member
Re: vs2022 locked file again, this time not on opening a file
 Originally Posted by 2kaud
They ask you to perform certain steps that produce debug/log files that you then post to them when the issue arises.
Has the reported issue database been searched to see if a similar issue has already been reported?
Have not reported anything to MS.
How would you do that? From within VS2022?
It has been a totally random thing so far seems to me. It has done this lock maybe 3 or 4 times since I started using VS2022 about 3 months ago.
-
May 23rd, 2024, 03:36 AM
#25
Re: vs2022 locked file again, this time not on opening a file
How would you do that? From within VS2022?
From VS2022 help/SendFeedback/Report a problem.
All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/
C++23 Compiler: Microsoft VS2022 (17.6.5)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|