The exception that is thrown when an operation is performed on a disposed object.
Questions tagged [objectdisposedexception]
190 questions
6
votes
1 answer
Cannot access a disposed object - wcf client
I have a WCF client that I'm having problems with.
From time to time I am getting this exception: Cannot access a disposed object. This is how I am opening the connection:
private static LeverateCrmServiceClient crm = null;
public static…

SexyMF
- 10,657
- 33
- 102
- 206
5
votes
1 answer
System.ObjectDisposedException throwed on WebSocket communication
I'm trying to communicate between a web browser client and an ASP.NET server using WebSockets.
I make a set of requests, of different sizes and with some seconds of elapsed time between each of them. The three first ones pass correctly, but a…

Aracthor
- 5,757
- 6
- 31
- 59
5
votes
1 answer
vNext. AspNet.Identity and custom UserStore. UserStore disposed exception
I'm trying to understand vNext.
I wrote custom UserStore, that works with MongoDB and implements these interfaces:
public class UserStore : IUserStore, IUserPasswordStore,…

no_one
- 51
- 3
4
votes
2 answers
Why is my FileStream object being disposed of when I'm "using" a BinaryReader object?
Consider the following function:
private int GetSomethingFromFile(FileStream fs)
{
using (BinaryReader br = new BinaryReader(fs))
{
fs.Seek(0, SeekOrigin.Begin);
return br.ReadInt32();
}
…

raven
- 18,004
- 16
- 81
- 112
4
votes
1 answer
C# WinForms: Cannot access a dispose object
I have a datagridview. This datagridview has customs datagridviewcolumns among other like datagridviewtextboxcolumns. Third-party control is hosted in each cell. So as datagridview is designed, on custom cells, content cannot be shown unless you are…

Willy
- 9,848
- 22
- 141
- 284
3
votes
2 answers
Handling ObjectDisposedException and similar exceptions during the process shutdown?
My application generally running on 10-20 threads and these threads sending events to the GUI to the update certain controls almost every seconds.
When the user close the application middle of these, all updates related with these events causes…

dr. evil
- 26,944
- 33
- 131
- 201
3
votes
3 answers
ObjectDisposedException was unhandled: Safe handle has been closed at program end
I have a .NET 4 C# console application. It pulls data from our IBM i and sends it to our internet SQL Server. It works perfect until it ends, I get the following error:
System.ObjectDisposedException was unhandled Message=Safe handle has
been…

Mike Wills
- 20,959
- 28
- 93
- 149
3
votes
2 answers
Does the WPF DocumentPaginator keep all DocumentPages in memory until it finishes a print job?
Strictly theoretical question concerning WPF's DocumentPaginator:
When using the WPF DocumentPaginator class to print a multi-page document, does the paginator keep all of the DocumentPages it requests over the history of the print job in memory…

Steven D.
- 311
- 4
- 10
3
votes
2 answers
Lambda encountered an UnobservedTaskException - Cannot access a disposed object
I've been noticing this exception in the CloudWatch logs for an AWS Lambda.
Everything seems to get processed so I think it is an exception within the AWS code (as opposed to something I've written) that is created after the Lambda has finished…

John
- 1,286
- 2
- 14
- 22
3
votes
3 answers
NHibernate Session ObjectDisposedException
Is there anyway to verify if a Session has been disposed of by NHibernate?
I have a wrapper class on Session that has it's own Finalizer and IDispoable implementation however if the Session gets disposed before I handle it myself in my class I end…

Chris Marisic
- 32,487
- 24
- 164
- 258
3
votes
0 answers
ObjectDisposedException when calling Abort on an HttpWebRequest used asynchronously
As the title indicates, I seem to be getting an ObjectDisposedException when calling "Abort" on an HttpWebRequest used asynchronously (i.e. BeginGetResponse) and can't, for the life of me, figure out how to prevent it. I have spent all day…

dreyln
- 860
- 1
- 9
- 18
3
votes
2 answers
UdpClient.ReceiveAsync correct early termination
Good day. I work with UdpClient and have wrapper upon it.
For reading I have asynchronous method:
private async Task Receive(UdpClient client, CancellationToken breakToken)
{
// Выход из async, если произошёл CancellationRequest
…

EgoPingvina
- 734
- 1
- 10
- 33
3
votes
1 answer
ObjectDisposedException - DangerousAddRef
I got a somehow complex .net console application, that uses WPF for some notification windows and also does some http calls.
In very rare cases, that application crashes and the only error message I'm able to get comes from windows event…

DanielG
- 1,217
- 1
- 16
- 37
3
votes
2 answers
Form gets disposed somehow
I have a client-server application, in which I use classic Sockets and threads for receiving/sending data and listening for clients.
The application works fine, but after some random time I get the…

mnn
- 1,952
- 4
- 28
- 51
3
votes
1 answer
System.ObjectDisposedException in Multithreaded Application
I am writing a simple program to test out various functions of VB.NET, I will later use this in a much more complex program. The idea is to send a message via the serial port com5. The message will be taken from what is entered in the application's…

TeslaK20
- 223
- 2
- 8