Closed AndrewAtAvenza closed 8 years ago
I managed to figure out how to jam in the MetroLog code into my app so I could debug into the ShareLogFile() call. It looks like I'm getting a System.UnauthorizedAccessException when attempting to get the stream in DoCreateEntryFromFile(). Specifically, this line gives the exception:
using (Stream stream = (await sourceFile.OpenReadAsync()).AsStream())
Oddly enough, if I try to catch it, I get a null pointer for the exception. I only know what it is because I see:
Exception thrown: 'System.UnauthorizedAccessException' in mscorlib.dll Exception thrown: 'System.UnauthorizedAccessException' in mscorlib.dll
In the output window.
Figured it out; stupid user error. I was getting the default configuration, and then adding a StreamingFileTarget. This meant there were two identical file targets, so even though it would shut down & close the internal write streams for one, the other would still be open, causing a read access.
Obviously this was my fault, but it might worth thinking about adding some kind of idiot-proofing to make sure there aren't more than one log target pointing at the same file, at least within one Logger,
We had some issues with ShareLogFile() failing with 0.8.6 (old, I know). It looked like it might be a Windows 8.1 vs Windows 10 issue; if there were a lot of files, it would fail on W8.1 but work in W10.
I updated to 1.0.1 and now ShareLogFile() doesn't work at all, at least in W10 (I haven't tested W8.1 yet). I just get "There was a problem with the data from." There's no output to give me a clue about what's wrong unfortunately.
I tried to build the source so I could step into ShareLogFile() and see what's going wrong, but as dumb as it sounds, I couldn't figure out how to build the project as a stand-alone. I get all sorts of complaints about missing references.