I have an application that zips up some files and then attempts to send that in an e-mail as an attachment.
I have noticed that if the zip file is small it works fine (A few KB's), but the zip is generally between 1 and 2 MB's, and at that size (Which is still rather small) it fails. I get an error that it failed due to the target of an invocation.
I'm assuming that perhaps the zip file is not being released prior to the e-mail being generated when it's larger? I have both the zip creation and e-mail generation in their own backGroundWorkers.
I've been working on this for a good while now, and it doesn't seem to matter if my AntiVirus is running (I thought maybe it was trying to scan the zip), if I do a thread.Sleep, if I choose to send the mail upon the click of another button, etc. In fact, curiously, I created a test application that ONLY sends the zip file. This works perfectly. However, if I use my main application to create the zip file, this test application will be unable to send the zip until after the main application is closed. I really think that the file is not being released, but I don't know why, or from what. The backgroundWorker that is creating the zip is completing successfully (That is where I was originally calling the SendMail event).
My question is what the suggested course of action would be for doing something like this. I've never had an issue with accessing a file like this before.
I really appreciate any suggestions anyone may have for this. I can post whatever code you want, but there's a lot of it, so I'm not sure what all you would want.
The better these AI models get, the more this is going to happen. It's gonna turn into government versus government in regards to using proprietary and unavailable security research models to basically find flaws and vulnerabilities in other governments or companies systems. It's basically turning into a cybersecurity arms race.
This is actually a good thing. The better AI gets, the more restricted and expensive it's going to become, making it far less mainstream. This is good 👍
Question
M_Lyons10
Hello everyone.
I have an application that zips up some files and then attempts to send that in an e-mail as an attachment.
I have noticed that if the zip file is small it works fine (A few KB's), but the zip is generally between 1 and 2 MB's, and at that size (Which is still rather small) it fails. I get an error that it failed due to the target of an invocation.
I'm assuming that perhaps the zip file is not being released prior to the e-mail being generated when it's larger? I have both the zip creation and e-mail generation in their own backGroundWorkers.
I've been working on this for a good while now, and it doesn't seem to matter if my AntiVirus is running (I thought maybe it was trying to scan the zip), if I do a thread.Sleep, if I choose to send the mail upon the click of another button, etc. In fact, curiously, I created a test application that ONLY sends the zip file. This works perfectly. However, if I use my main application to create the zip file, this test application will be unable to send the zip until after the main application is closed. I really think that the file is not being released, but I don't know why, or from what. The backgroundWorker that is creating the zip is completing successfully (That is where I was originally calling the SendMail event).
My question is what the suggested course of action would be for doing something like this. I've never had an issue with accessing a file like this before.
I really appreciate any suggestions anyone may have for this. I can post whatever code you want, but there's a lot of it, so I'm not sure what all you would want.
Thanks Again,
Link to comment
https://www.neowin.net/forum/topic/846100-file-access-question-c/Share on other sites
11 answers to this question
Recommended Posts