Skip to content

Commit 6283da3

Browse files
committed
possible fix for the crash
1 parent d3dd37a commit 6283da3

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

src/UniGetUI/AutoUpdater.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,8 @@ bool ManualCheck
426426
// Check if the user has disabled updates
427427
if (!ManualCheck && Settings.Get(Settings.K.DisableAutoUpdateWingetUI))
428428
{
429-
Banner.IsOpen = false;
429+
// Banner is a UI element; always touch it from the UI thread.
430+
Window.DispatcherQueue.TryEnqueue(() => Banner.IsOpen = false);
430431
Logger.Warn("User disabled updates!");
431432
return true;
432433
}

src/UniGetUI/CrashHandler.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,22 @@ static string GetExceptionData(Exception e)
135135
}
136136
}
137137

138+
// Run the integrity check on a background thread with a tight timeout.
139+
// Running it synchronously on the UI thread can block for 20-30 s on slow
140+
// disks, and calling Environment.Exit while the UI thread holds WinRT locks
141+
// causes a native crash in coreclr!ProcessCLRException (null read @ 0x0).
138142
string iReport;
139143
try
140144
{
141-
var integrityReport = IntegrityTester.CheckIntegrity(false);
142-
iReport = IntegrityTester.GetReadableReport(integrityReport);
145+
var integrityTask = Task.Run(() => IntegrityTester.CheckIntegrity(false));
146+
if (integrityTask.Wait(TimeSpan.FromSeconds(5)))
147+
{
148+
iReport = IntegrityTester.GetReadableReport(integrityTask.Result);
149+
}
150+
else
151+
{
152+
iReport = "Integrity check timed out (> 5 s) — skipped in crash report";
153+
}
143154
}
144155
catch (Exception ex)
145156
{

0 commit comments

Comments
 (0)