Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharing violation when loading mime message from file #426

Closed
alex-becker-startp opened this issue Aug 22, 2018 · 1 comment
Closed

Sharing violation when loading mime message from file #426

alex-becker-startp opened this issue Aug 22, 2018 · 1 comment
Labels
bug Something isn't working

Comments

@alex-becker-startp
Copy link

Hi,

the method MimeMessage.Load(options, filePath) fails when the file is already opened by another process.
This is because you do not specify the FileShare attribute within the File.Open method.
To prevent the issue, modify the code as following:

using (FileStream fileStream = File.Open(fileName, FileMode.Open, FileAccess.Read))
using (FileStream fileStream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read))

Alex.

jstedfast added a commit that referenced this issue Aug 22, 2018
@jstedfast jstedfast added the bug Something isn't working label Aug 22, 2018
@jstedfast
Copy link
Owner

Thanks for catching this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants