dotnet / dotnet/winforms

[Bug]: NotifyIcon displays an empty, miniature black tooltip box when Text is string.Empty on Windows 11

Open
#15,051 2 comments 0 reactions 1 assignee Claimed by @LeafShi1 View on GitHub
untriaged
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
1d 13m
Merged PRs (30d)
85

Description

### .NET version

.NET 10.0.11

### Did it work in .NET Framework?

Not tested/verified

### Did it work in any of the earlier releases of .NET Core or .NET 5+?

不明

### Issue description

Image

これが仕様であるのであれば申し訳ありません。
ツールチップを空文字を設定すると画像のように空のツールチップが表示されます。
Notifyicon.csの659行目

```
data.uFlags |= NOTIFY_ICON_DATA_FLAGS.NIF_TIP;
data.Tip = _text;
```
とありますが、正しくは
```
if (_text is not "")
{
data.uFlags |= NOTIFY_ICON_DATA_FLAGS.NIF_TIP;
data.Tip = _text;
}
```
ではないでしょうか?

### Steps to reproduce

```
_notifyIcon.Text = string.Empty;
_notifyIcon.Icon = Resources.MemoryCleaner;
_notifyIcon.ContextMenuStrip = _contextMainItem;
_notifyIcon.Visible = true;
_notifyIcon.Text = string.Empty;
_notifyIcon.Icon = Resources.MemoryCleaner;
_notifyIcon.ContextMenuStrip = _contextMainItem;
_notifyIcon.Visible = true;
```
Textにstring.Emptyを設定する。

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.