Fixing File writing for EngineLogger#1415
Conversation
With the Natvis Diagnostics Logger work, the file logger would fail since it would not close the file. This PR also runs 'File.CreateText' in MIDebugCommandDispatcher so errors can be caught earlier and not set an invalid file path.
gregg-miskelly
left a comment
There was a problem hiding this comment.
I am not sure if this is worth the effort since I don't know how often this is used, but ideally we would probably stop holding the log file path as a string, and instead hold it as a StreamWriter since otherwise we could still hit failures when we try to re-open the stream.
Otherwise, LGTM
I'll take a stab at moving to StreamWriter. I also noticed there will be a bug if you try to run the command while debugging. Do we want to throw a warning if you try to change the output file mid-debug session? |
Makes sense, or fix it if that is just as easy. |
Making it a Stream was a bit difficult, I just added a check to see if a debug session is running and we will throw an error. |
Fixing File writing for EngineLogger (#1415)
With the Natvis Diagnostics Logger work, the file logger would assume fully qualified paths and would try to create it in the root drive, this would fail since it would not have access. The original change also did not close the ChannelLoggers so this PR fixes that.
This PR also runs
File.CreateTextin MIDebugCommandDispatcher so errors can be caught earlier and not set an invalid file path.