1
0
Fork 0

fix: ConvertWindow ItemTemplate XamlReader 실패 + 진단/예외 핸들러

- ConvertWindow의 ItemTemplate을 코드비하인드 XamlReader.Parse 대신
  XAML 안에 <ItemsControl.ItemTemplate>으로 인라인 정의.
  XamlReader는 code-behind 메서드를 wire-up할 수 없어
  Click="OnRemoveEntry"가 매번 실패 → ConvertWindow 생성 시 예외 발생,
  GUI 상태가 깨져 변환 버튼 클릭이 처리되지 않던 근본 원인.
- OnConvertClick에 진단 로그(%TEMP%\EverythingToJpeg_dialog.log) 추가
- App에 전역 unhandled exception 핸들러 — DispatcherUnhandled,
  AppDomain.UnhandledException, TaskScheduler.UnobservedTaskException 모두
  %TEMP%\EverythingToJpeg_unhandled.log에 기록 + 메시지박스로 즉시 노출

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yun Chan 2026-05-06 16:47:41 +09:00
parent e663921460
commit 8065bf7373
3 changed files with 124 additions and 51 deletions

View file

@ -13,6 +13,8 @@ public partial class App : Application
{
base.OnStartup(e);
WireGlobalExceptionLogging();
var parsed = CliRouter.Parse(e.Args);
switch (parsed.Mode)
@ -116,4 +118,38 @@ public partial class App : Application
try { File.WriteAllText(logPath, log.ToString()); } catch { }
}
}
private static void WireGlobalExceptionLogging()
{
var path = Path.Combine(Path.GetTempPath(), "EverythingToJpeg_unhandled.log");
void Append(string source, Exception? ex)
{
try
{
File.AppendAllText(path,
$"[{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}] {source}\n{ex}\n\n");
}
catch { }
}
AppDomain.CurrentDomain.UnhandledException += (_, e) =>
Append("AppDomain.UnhandledException", e.ExceptionObject as Exception);
Current.DispatcherUnhandledException += (_, e) =>
{
Append("Application.DispatcherUnhandledException", e.Exception);
MessageBox.Show(
"예기치 못한 오류:\n\n" + e.Exception.Message + "\n\n로그: " + path,
"EverythingToJpeg",
MessageBoxButton.OK, MessageBoxImage.Error);
e.Handled = true;
};
System.Threading.Tasks.TaskScheduler.UnobservedTaskException += (_, e) =>
{
Append("TaskScheduler.UnobservedTaskException", e.Exception);
e.SetObserved();
};
}
}