Skip to content

Improve error handling and debug logging in ProcessProtectionManager#389

Closed
CJKmkp wants to merge 8 commits intobetafrom
codex/review-code
Closed

Improve error handling and debug logging in ProcessProtectionManager#389
CJKmkp wants to merge 8 commits intobetafrom
codex/review-code

Conversation

@CJKmkp
Copy link
Member

@CJKmkp CJKmkp commented Mar 4, 2026

Motivation

  • Make the process protection code more robust by avoiding swallowed exceptions and adding lightweight debug diagnostics when lock/file operations fail.

Description

  • Introduced a DebugTag constant and a helper WriteDebugLog(string, Exception) to centralize debug output via System.Diagnostics.Debug.WriteLine.
  • Replaced numerous empty catch { } blocks with catch (Exception ex) and routed error details to WriteDebugLog for failures in locking, releasing, normalization, traversal, and enabling/disabling logic.
  • Replaced various direct Debug.WriteLine calls with WriteDebugLog and added short contextual messages like "释放文件锁失败", "锁定目录失败", and "启用保护失败".
  • Kept original behavior of swallowing exceptions for production flow while providing more useful debug traces during development.

Testing

  • Built the solution and ran the existing automated unit test suite; all tests passed successfully.

Codex Task

…port and error logging"

This reverts commit 8867f69c617b7dab02d8030917bb3cf1ea239a65.
Copy link
Collaborator

@doudou0720 doudou0720 left a comment

Choose a reason for hiding this comment

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

请使用符合提交规范的提交信息

@CJKmkp CJKmkp closed this Mar 4, 2026
@CJKmkp CJKmkp deleted the codex/review-code branch March 4, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants