- In the extension bar, click the AdBlock Plus icon
- Click the large blue toggle for this website
- Click refresh
- In the extension bar, click the AdBlock icon
- Under "Pause on this site" click "Always"
- In the extension bar, click on the Adguard icon
- Click on the large green toggle for this website
- In the extension bar, click on the Ad Remover icon
- Click "Disable on This Website"
- In the extension bar, click on the orange lion icon
- Click the toggle on the top right, shifting from "Up" to "Down"
- In the extension bar, click on the Ghostery icon
- Click the "Anti-Tracking" shield so it says "Off"
- Click the "Ad-Blocking" stop sign so it says "Off"
- Refresh the page
- In the extension bar, click on the uBlock Origin icon
- Click on the big, blue power button
- Refresh the page
- In the extension bar, click on the uBlock icon
- Click on the big, blue power button
- Refresh the page
- In the extension bar, click on the UltraBlock icon
- Check the "Disable UltraBlock" checkbox
- Please disable your Ad Blocker
- Disable any DNS blocking tools such as AdGuardDNS or NextDNS
- Disable any privacy or tracking protection extensions such as Firefox Enhanced Tracking Protection or DuckDuckGo Privacy.
If the prompt is still appearing, please disable any tools or services you are using that block internet ads (e.g. DNS Servers, tracking protection or privacy extensions).
Question
James Rose
Ok gang,
I've got an interesting problem. I have a .net 2.0 app that goes off to a server to get a file and unzip it locally. This process is threaded. It's possible that during the first run through the process the end-user may need to stop the original process and go get a different file.
So, I abort the initial thread and start over. The issue? (Glad you asked) Seems that one or more files (the zip and possibly files from within the zip file, depending on how far along the initial process is) will not delete (File.Delete(path) as these files are in use my another process.
Exact error:
Description: The process cannot access the file 'c:\TestExtract\75872-01-1.ado' because it is being used by another process.
The code that is pulling the file from the zip is here:
--- BEGIN CODE CHUNK --------
If (sFileName <> String.Empty) Then
Dim StreamWriter As FileStream = File.Create(sDirectory & theEntry.Name)
Dim Size As Integer = 2048
Dim data(2048) As Byte
While (True)
Size = stmZipFile.Read(data, 0, data.Length)
If (Size > 0) Then
StreamWriter.Write(data, 0, Size)
Else
Exit While
End If
End While
StreamWriter.Close()
End If
--- END OF CODE CHUNK --------
Ive tried watching for the thread's abort request in that loop, but it never gets it. So I can't close the stream (arg)
I've looked to see if I can get the handle of the process that is using the file so I can kill the process and then the file... but so far no luck. I'm heading home now, but I'll check back in a few hours (it's 5pm est)
Thanks for any ideas.
Link to comment
https://www.neowin.net/forum/topic/578013-vbnet-delete-file-in-process/Share on other sites
4 answers to this question
Recommended Posts