Trying to attach log to send feedback

Hey, I’m building an in-game feedback tool and would like to attach the log file if it’s a bug report. I’m currently getting the screenshot by to get the file by Attachment image = new Attachment(fullPathName, MediaTypeNames.Application.Octet);, and it works great!

I thought the logfile would be just as easy, but when I do Attachment logFile = new Attachment(Application.consoleLogPath, MediaTypeNames.Text.RichText);, I get the error:
error

IOException: Sharing violation on path C:\Users\Jonathan\AppData\Local\Unity\Editor\Editor.log
System.IO.FileStream…ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) (at :0)
System.IO.FileStream…ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) (at :0)
(wrapper remoting-invoke-with-check) System.IO.FileStream…ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
System.IO.File.OpenRead (System.String path) (at :0)
System.Net.Mail.AttachmentBase…ctor (System.String fileName, System.String mediaType) (at :0)
System.Net.Mail.Attachment…ctor (System.String fileName, System.String mediaType) (at :0)
palimon.FeedbackManager+d__13.MoveNext () (at Assets/UIElements/FeedbackManager.cs:121)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at :0)

I assume this is because Unity has the file open to write to, but I’m not sure what to do about that, or how to get past this. Any ideas?

Thanks in advance for any help!

There’s some useful information here about that problem: c# - Send Log file with email? Unity - Stack Overflow

It looks like you may need to copy the file temporarily and delete it afterwards.

Ahh thanks! I’ll check that out. I was assuming I would have problems reading it period, but perhaps the Attachment method is trying something extra it can’t get permission for.