Describe the bug
MsgReder.Mime.Message.Save(FileInfo fileInfo) does not dispose of the stream it creates.
To Reproduce
call MsgReder.Mime.Message.Save(FileInfo fileInfo)
Expected behavior
The file stream that is created inside the method should be disposed.
Additional context
By not disposing the file stream the program keeps the file handles open, blocking access to the file (i.e. file is used by another process exceptions elsewhere).
public void Save(FileInfo file)
{
if (file == null)
{
throw new ArgumentNullException("file");
}
Save(file.OpenWrite());
}
should be
public void Save(FileInfo file)
{
if (file == null)
{
throw new ArgumentNullException("file");
}
using var messageStream = file.OpenWrite();
Save(messageStream);
}
Describe the bug MsgReder.Mime.Message.Save(FileInfo fileInfo) does not dispose of the stream it creates.
To Reproduce call MsgReder.Mime.Message.Save(FileInfo fileInfo)
Expected behavior The file stream that is created inside the method should be disposed.
Additional context By not disposing the file stream the program keeps the file handles open, blocking access to the file (i.e. file is used by another process exceptions elsewhere).
should be