469,898 Members | 1,626 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

FileSystemWatch and AppDomain.Unload

Tao
hi.. group,

A wired question about FileSystemWatcher and Unload an AppDomain.

I have a class A which creates class B. When B is created, B loads an
AppDomain and execute some functions on the load AppDomain.

B monitors disk to see if some files chang. If some file changes, B will try
to unload the AppDomain it loaded before.

Problem is the AppDomain.Unload never returns if it is called in
FileSystemWatcher event handler, it does not give exception either. The
AppDomain does not get unloaded.

I tried to unload after the function calls, unload works fine. Only in the
FileSystemWatcher, the AppDomain stucks and no exception, debug cursor
disappears.

It is really wired.

Thanks
Mar 23 '07 #1
3 2399
Hi,

"Tao" <tt*******@hotmail.comwrote in message
news:eD**************@TK2MSFTNGP03.phx.gbl...
hi.. group,

A wired question about FileSystemWatcher and Unload an AppDomain.

I have a class A which creates class B. When B is created, B loads an
AppDomain and execute some functions on the load AppDomain.

B monitors disk to see if some files chang. If some file changes, B will
try to unload the AppDomain it loaded before.

Problem is the AppDomain.Unload never returns if it is called in
FileSystemWatcher event handler, it does not give exception either. The
AppDomain does not get unloaded.

What kind of app is this?
IF a win app use Application.ThreadException

Additionally use AppDomain.UnhandledException

Most probably you are getting an exception somewhere.
Mar 23 '07 #2
Thanks, Ignacio,

That is something really wired. It just stop there, I put

try.. catch (exception ex)

No exception, does not return. But it is good that it does not freeze the
whole application though.

"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

"Tao" <tt*******@hotmail.comwrote in message
news:eD**************@TK2MSFTNGP03.phx.gbl...
hi.. group,

A wired question about FileSystemWatcher and Unload an AppDomain.

I have a class A which creates class B. When B is created, B loads an
AppDomain and execute some functions on the load AppDomain.

B monitors disk to see if some files chang. If some file changes, B will
try to unload the AppDomain it loaded before.

Problem is the AppDomain.Unload never returns if it is called in
FileSystemWatcher event handler, it does not give exception either. The
AppDomain does not get unloaded.


What kind of app is this?
IF a win app use Application.ThreadException

Additionally use AppDomain.UnhandledException

Most probably you are getting an exception somewhere.
Mar 23 '07 #3
BTW: the application is a disaster for C# developer.

the main app is C++ (not managed), it starts up a .NET runtime component and
invoke a managed class. The managed class is where I starts.

thanks

"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

"Tao" <tt*******@hotmail.comwrote in message
news:eD**************@TK2MSFTNGP03.phx.gbl...
hi.. group,

A wired question about FileSystemWatcher and Unload an AppDomain.

I have a class A which creates class B. When B is created, B loads an
AppDomain and execute some functions on the load AppDomain.

B monitors disk to see if some files chang. If some file changes, B will
try to unload the AppDomain it loaded before.

Problem is the AppDomain.Unload never returns if it is called in
FileSystemWatcher event handler, it does not give exception either. The
AppDomain does not get unloaded.


What kind of app is this?
IF a win app use Application.ThreadException

Additionally use AppDomain.UnhandledException

Most probably you are getting an exception somewhere.
Mar 23 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Satinderpal Singh | last post: by
4 posts views Thread by Chris Lacey | last post: by
4 posts views Thread by Mirano | last post: by
2 posts views Thread by Lauren Hines | last post: by
6 posts views Thread by Wal Turner | last post: by
22 posts views Thread by JPSutor | last post: by
2 posts views Thread by Tim | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.