-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Labels
💥 regression-releaseRegression from a public releaseRegression from a public releaseneeds-area-label
Milestone
Description
.NET version
.NET10 RC1 and RC2
Did it work in .NET Framework?
Yes
Did it work in any of the earlier releases of .NET Core or .NET 5+?
yes, works in .NET 10 preview 7
Issue description
I set the form.Icon to an existing one, and then close this form, but when I try to use the icon again, I get an error "Cannot access a disposed object."
But I found that not all the icons cause this problem.
Steps to reproduce
Here is the demo code,
public partial class Form1 : Form
{
private Icon ico;
public Form1()
{
InitializeComponent();
ico = new Icon("D:\\TestWinformIcon\\exception.size32.ico"); // change the path on your machine
}
private void button1_Click(object sender, EventArgs e)
{
var form = new Form2();
form.Icon = ico;
form.Show();
form.Close();
}
private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show(ico.Handle.ToString());
}
}
First click button1 and then click button2, exception dialog pops.
Full code here with icon included:
kirsan31
Metadata
Metadata
Assignees
Labels
💥 regression-releaseRegression from a public releaseRegression from a public releaseneeds-area-label