Skip to content

Conversation

@workbysaran
Copy link
Contributor

Resolved / Related Issues
Added additional debug logging to help troubleshoot a crash that occurs when switching apps. The issue cannot be reproduced locally, so these logs will help diagnose the problem on affected user machines.

Related to #17701

Steps used to test these changes

  1. Launch the Files app, enable the Preview Pane
  2. Navigate to multiple files and switch to other applications using Alt+Tab
  3. Switch back to Files app and verify no crash occurs
  4. Check debug logs for proper logging of window activation states

public void Dispose()
{
CancelLoadAndClearFiles();
App.Logger.LogInformation($"ShellViewModel.Dispose: CurrentFolder={LogPathHelper.GetDirectoryName(CurrentFolder?.ItemPath)}");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: ShellViewModel.cs and ShellPanesPage.xaml.cs call LogPathHelper but are missing the required using Files.App.Helpers; directive, which will cause a compilation failure.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

The files ShellViewModel.cs and ShellPanesPage.xaml.cs both make calls to the new helper method LogPathHelper.GetDirectoryName(). However, neither file includes the necessary using Files.App.Helpers; directive to import the namespace where LogPathHelper is defined. This will result in a CS0103 compilation error ("The name 'LogPathHelper' does not exist in the current context") in both files, which will prevent the project from building.

💡 Suggested Fix

Add the line using Files.App.Helpers; to the top of both src/Files.App/ViewModels/ShellViewModel.cs and src/Files.App/Views/ShellPanesPage.xaml.cs to resolve the missing reference to the LogPathHelper class.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/Files.App/ViewModels/ShellViewModel.cs#L2799

Potential issue: The files `ShellViewModel.cs` and `ShellPanesPage.xaml.cs` both make
calls to the new helper method `LogPathHelper.GetDirectoryName()`. However, neither file
includes the necessary `using Files.App.Helpers;` directive to import the namespace
where `LogPathHelper` is defined. This will result in a CS0103 compilation error ("The
name 'LogPathHelper' does not exist in the current context") in both files, which will
prevent the project from building.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 7334093

@yaira2 yaira2 added the ready for review Pull requests that are ready for review label Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review Pull requests that are ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants