Skip to content

Commit 0bf290d

Browse files
Code Quality: Guard against Logger being null during activation (#17513)
Co-authored-by: seer-by-sentry[bot] <157164994+seer-by-sentry[bot]@users.noreply.github.com>
1 parent e395254 commit 0bf290d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Files.App/App.xaml.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,10 @@ async Task ActivateAsync()
160160
public async Task OnActivatedAsync(AppActivationArguments activatedEventArgs)
161161
{
162162
var activatedEventArgsData = activatedEventArgs.Data;
163-
Logger.LogInformation($"The app is being activated. Activation type: {activatedEventArgsData.GetType().Name}");
163+
164+
// Logger may not be initialized yet due to race condition during startup
165+
if (Logger is not null)
166+
Logger.LogInformation($"The app is being activated. Activation type: {activatedEventArgsData.GetType().Name}");
164167

165168
// InitializeApplication accesses UI, needs to be called on UI thread
166169
await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(()

0 commit comments

Comments
 (0)