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 up receiving an ObjectDisposedException.
I really don't wish to wrap my clean up code wit...
The computer is connected to measuring device via a physical COM1. I have simple form where I open a serial port, tell the device that I'm alive and occasionally the device sends data. (every some minutes)
Thread _readThread = new Thread(Read);
SerialPort _serialPort = new SerialPort("COM1", 9600);
_serialPort.Parity = Parity.None;
_ser...
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 several random crashes. Mostly ObjectDisposedException and NullReferenceException.
Since the...
Ok guys there is this sudden problem in my code which didn't appear before..
public void StartUdpListener(Object state)
{
/* sock1 = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
sock1.Bind(receiveEndPoint);
EndPoint ep = (EndPoint)receiveEndPoint;*/
recv = sock1.R...
I'm using this piece of code to process a connection to a server and read data from the client
using(var client = _listener.EndAcceptTcpClient(ar))
{
var clientStream = client.GetStream();
// Get the request message
Messages.ReceiveMessage(clientStream, msg => ProcessRequest(msg, clientStream));
}
Now, the Rec...
I want the user to simply be able to exit my application. However, for some reason, code which I have on a time delay, controlled by a stopwatch, is still trying to execute. I do not care if it tries to do so or not, but I want to stop the error and force-quit the application, terminating ALL running threads where they stand.
I am using...
When implementing IDisposable, I undertand that every method that shouldn't be called after the object's been disposed should throw the ObjectDisposedException. But what is the standard for the name object that should be passed to the exception's constructor?
...
I have a stopwatch running in a different thread, that updates the GUI thread in a label to show as time goes by. When my program closes, it throws a ObjectDisposedException when I call this.Invoke(mydelegate); in the Form GUI to update the label with the time from the stopwatch.
How do I get rid of this ObjectDisposedException?
I...
Is there any point in keeping track of the classic bool disposed field on an otherwise threadsafe type for the purposes of conditionally throwing an ObjectDisposedException at the beginning of all primary exposed methods?
I've seen this pattern recommended in a few places online but I'm not sure if the authors are using it correctly, ...
Hi!
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;
ProgressBar progressBar;
Panel panelHolder;
public Drawing(ref ProgressBar pgbar,...
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 forms. The sub forms are shown from menus and/or buttons from the main form like so:
p...
I'm building a 4 layered ASP.Net web application.
The layers are:
Data Layer
Entity Layer
Business Layer
UI Layer
The entity layer has my data model classes and is built from my entity data model (edmx file) in the datalayer using T4 templates (POCO). The entity layer is referenced in all other layers.
My data layer has a class call...
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 ObjectDisposedException:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'MainForm'.
at System.Windows.For...
I am attempting to show a specific form using a treeview control, the nodes of which have their tag value set to an instance of the Form I need to show. The code I have in the DoubleClick event works great for the first time I show a form, but after that I get an object disposed exception. As you can see, I tried handling it by resetti...
I was trying to write the following simple extension method for RSAKeyValue:
public static class RSAKeyValueExtensions
{
public static string ToXmlString(this RSAKeyValue keyValue)
{
return keyValue.GetXml().OuterXml;
}
}
However, it seems whenever I use ToXmlString, I get an exception:
System.ObjectDisposedExc...
Hi,
I have implemented a dispose pattern in a class model which uses MessageQueue. My class A where all objects from class B must register to contains a Dictionary with MessageQueue objects. This works all fine. Objects from class B can be collect by GC and the dispose pattern, which let each object from class B sent a last message duri...