Slazanger / SMT

Slazanger's Eve Map Tool
MIT License
264 stars 77 forks source link

Unexpected Application Crash: Intermittant #110

Closed lorensghassan closed 1 year ago

lorensghassan commented 1 year ago

While loading the application to check out performance, I encountered an unexpected crash. I used the Event Viewer to generate a log view of .NET exceptions in the last 12 hours, and I discovered this .NET Core error for SMT {folder path obfuscated for reporting purposes}:

Application: SMT.exe CoreCLR Version: 6.0.522.21309 .NET Version: 6.0.5 Description: The process was terminated due to an unhandled exception.

======== Exception Info: System.UnauthorizedAccessException: Access to the path '%UserProfile%\Documents\SMT\IntelChannels.txt' is denied. at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize) at System.IO.StreamWriter.ValidateArgsAndOpenPath(String path, Boolean append, Encoding encoding, Int32 bufferSize) at System.IO.File.WriteAllLines(String path, IEnumerable`1 contents) at SMT.EVEData.EveManager.SaveData() in D:\Projects\SMT\EVEData\EveManager.cs:line 1822 at SMT.MainWindow.MainWindow_Closed(Object sender, EventArgs e) in D:\Projects\SMT\SMT\MainWindow.xaml.cs:line 490 at System.Windows.Window.OnClosed(EventArgs e) at System.Windows.Window.WmDestroy() at System.Windows.Window.WindowFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

========

A review of my settings shows that chat logs are being properly collated and consumed by the application, and when reloading SMT, the intel feeds are correct. I was unable to reliably reproduce the bug a second time in the same session. Reporting this as a potential bug.

tehraven commented 1 year ago

The first line is pretty telling.

Exception Info: System.UnauthorizedAccessException: Access to the path '%UserProfile%\Documents\SMT\IntelChannels.txt' is denied.

Seems like there is a OS-level issue with the file/folder permissions where SMT stores it's txt files. Specifically when it's trying to Create the file because it doesn't exist.

I'm not sure about the Win32 environment (I don't work on it) but this sounds like an old school error where there's a read-or-create-file call and the Read fails, so the app assumes the file doesn't exist at all. Can lead to an erroneous Create call on a file that does, in fact, exist.

👀 on Slaz

lorensghassan commented 1 year ago

It occurred again in a later session without a crash, so I can safely that its unrelated to a crash by itself. I wonder at the specific cause; maybe its just a startup or cleanup issue around the application lifetime cycle. I will test a little further, and if I cannot reproduce the crash, I will close it as unrelated to the application itself, for now.

lorensghassan commented 1 year ago

Fascinating; the error consistently happens if SMT is left open when the EVE client is closed down, at least on my system. This is an interesting behavior, but certainly not a significant application bug at this time. Closing.