Skip to content

Guard NotifyIcon.Text against 63-char Windows limit#126

Merged
cerebrate merged 2 commits into
devfrom
copilot/sub-pr-123-another-one
Feb 28, 2026
Merged

Guard NotifyIcon.Text against 63-char Windows limit#126
cerebrate merged 2 commits into
devfrom
copilot/sub-pr-123-another-one

Conversation

Copilot AI commented Feb 28, 2026

Copy link
Copy Markdown
Contributor

NotifyIcon.Text throws ArgumentException if assigned a string longer than 63 characters. The jiggling tooltip — which includes period, random-variation flag, mode, and distance — can easily exceed this limit, crashing the app on tray icon updates.

Changes

  • MainForm.cs: Added MaxNotifyIconTextLength = 63 constant; truncates tooltip to 60 chars with ... when over the limit:
private const int MaxNotifyIconTextLength = 63;

// in UpdateNotificationAreaText:
var text = $"Jiggling mouse every {this.JigglePeriod} s,{rnd} mode: {mode}{this.JiggleDistance}).";
this.niTray.Text = text.Length > MaxNotifyIconTextLength
    ? text[..(MaxNotifyIconTextLength - 3)] + "..."
    : text;

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…ption

Co-authored-by: cerebrate <371623+cerebrate@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP address feedback from PR #123 for milestone changes Guard NotifyIcon.Text against 63-char Windows limit Feb 28, 2026
@cerebrate cerebrate marked this pull request as ready for review February 28, 2026 06:05
Copilot AI review requested due to automatic review settings February 28, 2026 06:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Guards WinForms tray tooltip updates against the Windows NotifyIcon.Text 63-character limit to prevent ArgumentException crashes during tray icon updates.

Changes:

  • Introduced a MaxNotifyIconTextLength = 63 constant in MainForm.
  • Truncates the dynamic “jiggling” tooltip text and appends ... when it would exceed the limit.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread MouseJiggler/MainForm.cs
@cerebrate cerebrate merged commit 802dd36 into dev Feb 28, 2026
4 checks passed
@cerebrate cerebrate deleted the copilot/sub-pr-123-another-one branch February 28, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants