0

Hi all,

I'm writing a simple application in C# but I'm having an annoying ArgumentOutOfRangeException thrown by Invoke() saying "Text length must be less than 64 characters long.".

Is this usual that strings passed through delegates have to be shorter than 64 characters? What's the usual neat way around it? Do I have to box it in some container class?

The code is here:

public enum StatusIcons { NoChange, Idle, Download, Fail, Reply, ShuttingDown, Pause } ;
public void updateStatus(string description, StatusIcons icon = StatusIcons.NoChange, string tooltip = null)
{
    if (this.InvokeRequired)
    {
        System.Diagnostics.Debug.Print("invoke {0},{1}: \r\n{2}\r\n{3}", description.Length, tooltip!= null ? tooltip.Length : 0, description, tooltip);
        this.Invoke(new Action<string,StatusIcons,string>(updateStatus), description, icon, tooltip);
    }
    else
    {
        if (description != null)
        {
            tsStatus.Text = description;
            notify.Text = description;
        }

        if (icon != StatusIcons.NoChange)
            notify.Icon = getIcon(icon);

        if (tooltip != null)
        {
            notify.BalloonTipText = tooltip;
            notify.ShowBalloonTip(2000);
        }
    }
}

Edited by dougy83

2
Contributors
2
Replies
13
Views
3 Years
Discussion Span
Last Post by dougy83
1

I'm inferring from your code that you're using a NotifyIcon with some tooltip text. The limitation actually resides here, as the text for this can be no longer than 63 characters.

It's possible to hack around it using reflection, but if you can get it down to 63 characters that would be much cleaner.

Note: The maximum possible length is 127 characters, even with the hack

Edited by Ketsuekiame

0

Thanks very much for the reply. You're completely right. 63 characters is enough for my notify tooltip purposes, really.

Edited by dougy83

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.