The exception that is thrown when an operation is performed on a disposed object.
Questions tagged [objectdisposedexception]
190 questions
3
votes
2 answers
ObjectDisposedException when .Show()'ing a form that shouldn't be disposed
ive checked out some of the other questions and obviously the best solution is to prevent the behavior that causes this issue in the first place, but the problem is very intermittent, and very un-reproduceable.
I basically have a main form, with sub…

user320781
- 303
- 4
- 7
3
votes
2 answers
c# opennetCF background worker - e.result gives a ObjectDisposedException
I'm new working with background worker in C#.
Here is a class, and under it, you will find the instansiation of it, and under there i will define my problem for you:
I have the class Drawing:
class Drawing
{
BackgroundWorker bgWorker;
…

Ikky
- 2,826
- 14
- 47
- 68
3
votes
1 answer
Why it always throws an ObjectDisposedException?
Due to the fact that the windows phone can't handle gif, I write a little method, but it seems that it has a little error.
The code below always throws a exception when it runs to (JPG and PNG part)bitimg.SetSource(e.Result); As it said, does it…

Albert Gao
- 3,653
- 6
- 40
- 69
3
votes
0 answers
RSACryptoServiceProvider.ImportParameters ObjectDisposedException
We have a webservice we would like to sign an incoming request and send it further. We are using the static object of System.Security.Cryptography.RSACryptoServiceProvider and every instance is using the same static object to sign it. I read on…

sandeep
- 996
- 2
- 11
- 22
2
votes
4 answers
Open the closed form
I'm wondering how I can open again the closed form from using this.Close(). Every time I'm trying to open the closed form using Mainmenu.Show(), the exception throws an error "cannot access the disposed object. Object name: Mainmenu".
How can I open…

Sephiroth111
- 127
- 1
- 5
- 14
2
votes
1 answer
System.ObjectDisposedException: Cannot access a disposed object - Why happening?
I got the error having the stack trace...
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Button'.
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at…

rai
- 21
- 1
- 2
2
votes
3 answers
Disposing objects exception
While crawling through sources on the web, I've encountered a lot of boiletplate code which looks the following way:
Suppose we have some public class CustomObject: IDisposable, which has a bunch of methods.
Now, each of those methods has default…

Yippie-Ki-Yay
- 22,026
- 26
- 90
- 148
2
votes
3 answers
How can I resolve inexplicable ObjectDisposedExceptions in my C# / MVVM application?
I've written my first MVVM application. When I close the application, I often get a crash cause by an ObjectDisposedException. The crash appears as the application dies, just after the app window disappears.
Getting a stacktrace was difficult (see…

Grant Birchmeier
- 17,809
- 11
- 63
- 98
2
votes
1 answer
Polly Retry : System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Flurl.Http.Content.FileContent'
I'm using flurl and polly as part of my code to post asynchronously - I'm having an issue with the retry policy and the file content getting disposed, on a retry the FileContent option has been disposed.
I will get the following…

Little Geeza
- 33
- 4
2
votes
1 answer
GZipStream.Close causes ObjectDisposedExeption: Why?
Can anyone explain this?

richard
- 12,263
- 23
- 95
- 151
2
votes
3 answers
ObjectDisposedException / SocketsHttpHandler in .NET 3.1
I am using asp.net core in one of my projects and I am making some https requests with a client certificate. To achieve this, I created a typed http client and injected it in my startup.cs like the following:
services.AddHttpClient

NEO
- 61
- 1
- 6
2
votes
1 answer
ASP.Net Core DbContext disposed in HostedService
I have an ASP.Net Core application where i am trying to listen to messages coming from RabbitMQ. In order to do this i added a HostedService where a listener waits to receive messages. When a message comes in i want to save it to the database using…

RWael
- 19
- 3
2
votes
1 answer
Cannot access Response.OutputStream in an ASP.NET MVC application because it's closed
I'm trying to steam file in my web application from another domain and I'll zip this files for a download. For this I use Ionic Zip. But I've got this error on the marked line in my code:
System.ObjectDisposedException: No access to a closed…

H. Pauwelyn
- 13,575
- 26
- 81
- 144
2
votes
2 answers
Thread safe destructible event firing class in C#
Recently, I was asked to implement a class as part of a selection process. I did the program as requested. However, I failed in the test. I am really curious to know what is wrong in my solution. Any help is much appreciated. The question and my…

Jimmy
- 3,224
- 5
- 29
- 47
2
votes
3 answers
Request.Files[0].InputStream is disposed when put him inside a Thread
I tried to copy to a MemoryStream, like below, but without success
MemoryStream m = new MemoryStream();
Request.Files[0].InputStream.CopyToAsync(m);
ToDo(NameOfFile, m);
Forward i'm receiving this message:
An unhandled exception of type…

Helio Ferreira
- 163
- 1
- 3
- 11