Questions tagged [objectdisposedexception]

The exception that is thrown when an operation is performed on a disposed object.

190 questions
0
votes
3 answers

FileStream and ObjectDisposedException in .NET CF

public byte[] GetFile(string filename) { FileStream aStream = File.Open(filename, FileMode.Open, FileAccess.Read); BinaryReader binReader = new BinaryReader(aStream); binReader.BaseStream.Position = 0; byte[] binFile =…
mdc
  • 1,161
  • 6
  • 22
  • 37
-1
votes
1 answer

DbContext in ASP.NET Core throws System.ObjectDisposedException

I am saving a Todo model to database using EF Core in ASP.NET Core app. But when I try to print the success message using Console.Writeline it throws System.ObjectDisposedException Here's full application github code link Here's ToDo model: public…
-1
votes
3 answers

System.ComponentModel.Win32Exception: 'Error creating window handle.'

My problem is: System.ComponentModel.Win32Exception: 'Error creating window handle'. I know I can solve this problem with Dispose(), but when I use it in the program, I'm displaying another error: System.ObjectDisposedException: 'Can not access a…
-1
votes
2 answers

ObjectDisposedException - Control declared, unabe to access control

I am trying to make some code more concise and am throwing an exception when I try to, I suppose, dynamically define a control. Whichever way I try, a and b always return as disposed. I could separate the cases out, but that would make the code…
-1
votes
1 answer

System.ObjectDisposedException on a socket and when to close streams

I'm trying to code a client-server communication. So far, i manage to connect in a first thread. A second thread read the socket and a third one check if there is no unexpected disconection from a client. My problem is that i got a…
-1
votes
1 answer

Garbage Collector is grabbing my referenced TaskCompletionSource

Consider the snippet bellow. A form adds a BusyForm to the queue and later on, when the form is done, it sets the result for the TCS, marking it as complete, without removing the item from the queue. After a while, something happens and we need to…
Chris
  • 1,213
  • 1
  • 21
  • 38
-1
votes
1 answer

Draw giving me an objectDisposedException

The below code gives me a ObjectDisposedException. I load the contents in the content loader just fine. It works from time to time but occasionally it throws the exception. All textures are loaded perfectly and each and every object has the right…
Kraishan
  • 443
  • 5
  • 14
  • 38
-1
votes
1 answer

How to reopen a previously closed windows form. "Cannot access a disposed Object"

I've read several things like this here but found no solution in my problem. I'm sending data from form1 to my tempGraph form. Everything is OK not until I close my tempGraph form and try to reopen it. as i try to reopen it says CANNOT ACCESS A…
Solem
  • 17
  • 2
  • 7
-4
votes
2 answers

Solve my Object Disposed Exception

Hello can any1 tell me where to try catch this exception or solve it. Whenver i close my receive handle, if i still recieved some data, it comes up with this error. public partial class Form1 : Form { SerialPort sp; IAsyncResult…
-4
votes
1 answer

Windows Form causes ObjectDisposedException when closing

So I'm mostly new to C#, but I have created Forms before with it. I've searched for over an hour to try to find an answer, but everything I find either is hard to understand or worded in a way I don't understand, or it doesn't appear relevant. The…
1 2 3
12
13