Results 1 to 25 of 25

Thread: vs2022 locked file again, this time not on opening a file

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    667

    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

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    667

    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

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    667

    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

  4. #4
    Hyperactive Member
    Join Date
    Jul 2022
    Posts
    288

    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?

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    667

    Re: vs2022 locked file again, this time not on opening a file

    yes, a reboot and it can run again.

  6. #6
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,243

    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.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    667

    Re: vs2022 locked file again, this time not on opening a file

    Quote Originally Posted by OptionBase1 View Post
    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/

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    667

    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.

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    667

    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.

  10. #10
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,222

    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

  11. #11
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,525

    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.

  12. #12
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,243

    Re: vs2022 locked file again, this time not on opening a file

    Quote Originally Posted by sdowney1 View Post
    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.

  13. #13
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,584

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  14. #14
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,525

    Re: vs2022 locked file again, this time not on opening a file

    Quote Originally Posted by techgnome View Post
    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.

  15. #15
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,222

    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

  16. #16
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,222

    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.

  17. #17
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,525

    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.

  18. #18

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    667

    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.

  19. #19

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    667

    Re: vs2022 locked file again, this time not on opening a file

    Quote Originally Posted by jmcilhinney View Post
    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.

  20. #20
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,584

    Re: vs2022 locked file again, this time not on opening a file

    Quote Originally Posted by jmcilhinney View Post
    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  21. #21
    Frenzied Member 2kaud's Avatar
    Join Date
    May 2014
    Location
    England
    Posts
    1,028

    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)

  22. #22
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,525

    Re: vs2022 locked file again, this time not on opening a file

    Quote Originally Posted by 2kaud View Post
    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.

  23. #23
    Frenzied Member 2kaud's Avatar
    Join Date
    May 2014
    Location
    England
    Posts
    1,028

    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)

  24. #24

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2024
    Posts
    667

    Re: vs2022 locked file again, this time not on opening a file

    Quote Originally Posted by 2kaud View Post
    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.

  25. #25
    Frenzied Member 2kaud's Avatar
    Join Date
    May 2014
    Location
    England
    Posts
    1,028

    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
  •  



Click Here to Expand Forum to Full Width