Finalizer problem
-
Hello, I have an application which has some global resources. I use some system resources in these classes. The finalizer is called when the application is closed. The problem is that a part of the .NET framework (System.Net.Sockets) gets disposed before my object is disposed. How do I make sure that my object is finalized before the system resources? Behind every great black man... ... is the police. - Conspiracy brother Blog[^]
-
Hello, I have an application which has some global resources. I use some system resources in these classes. The finalizer is called when the application is closed. The problem is that a part of the .NET framework (System.Net.Sockets) gets disposed before my object is disposed. How do I make sure that my object is finalized before the system resources? Behind every great black man... ... is the police. - Conspiracy brother Blog[^]
Hi! I suggest you don't rely on a certain order of finalization (which is almost always a bad idea) but rather implement
IDisposable
and perform your cleanup inDispose()
. Regards, mav -
Hello, I have an application which has some global resources. I use some system resources in these classes. The finalizer is called when the application is closed. The problem is that a part of the .NET framework (System.Net.Sockets) gets disposed before my object is disposed. How do I make sure that my object is finalized before the system resources? Behind every great black man... ... is the police. - Conspiracy brother Blog[^]
Bob Stanneveld wrote:
How do I make sure that my object is finalized before the system resources?
That's not possible. In fact, members of an object might get finalized before the object itself. Regards Senthil _____________________________ My Blog | My Articles | WinMacro