diff --git a/EbayListingTool/App.xaml.cs b/EbayListingTool/App.xaml.cs index 278bd37..a6c0b71 100644 --- a/EbayListingTool/App.xaml.cs +++ b/EbayListingTool/App.xaml.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using System.Windows; using System.Windows.Threading; using Microsoft.Extensions.Configuration; diff --git a/EbayListingTool/Views/NewListingView.xaml.cs b/EbayListingTool/Views/NewListingView.xaml.cs index 3baa963..7e88e4e 100644 --- a/EbayListingTool/Views/NewListingView.xaml.cs +++ b/EbayListingTool/Views/NewListingView.xaml.cs @@ -671,7 +671,22 @@ public partial class NewListingView : UserControl SetState(ListingState.Success); GetWindow()?.SetStatus($"Listed: {_draft.Title}"); } - catch (Exception ex) { ShowError("Post Failed", ex.Message); } + catch (Exception ex) + { + // Log full stack trace to help diagnose crashes + try + { + var logPath = System.IO.Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), + "EbayListingTool", "crash_log.txt"); + var msg = $"{DateTime.Now:HH:mm:ss} [Post_Click] {ex.GetType().Name}: {ex.Message}\n{ex.StackTrace}\n"; + if (ex.InnerException != null) + msg += $" Inner: {ex.InnerException.GetType().Name}: {ex.InnerException.Message}\n"; + System.IO.File.AppendAllText(logPath, msg + "\n"); + } + catch { } + ShowError("Post Failed", ex.Message); + } finally { SetPostBusy(false); } }