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);
        if (description != null)
            tsStatus.Text = description;
            notify.Text = description;

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

        if (tooltip != null)
            notify.BalloonTipText = tooltip;

Recommended Answers

All 2 Replies

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.