In my project, when I run it by debugging, after some times, it suddenly has been crashed. It didnt happen in any special time or after specific period time. It crashed itself and I dont know why?!
I got this message:
An unhandled exception of type 'System.ObjectDisposedException' occurred in System.dll
Additional information: Cannot access a disposed object.
and its the picture of that, for more information...
Im working with vs 2013 and C# win form...
Its my simple code :
private void btnConnect_Click(object sender, EventArgs e)
{
Result = socketComponent.tcpConnect(Host, int.Parse(Port));
if (Result == 0)
MessageBox.Show("Connected");
}
private void btnDisconnect_Click(object sender, EventArgs e)
{
if (socketComponent != null)
{
socketComponent.tcpDisconnect();
socketComponent.Dispose();
MessageBox.Show("DisConnected");
}
}
It happened suddenly after click On btnDisconnect. maybe after second click or more ...