473,434 Members | 1,521 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,434 software developers and data experts.

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 2589
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Satinderpal Singh | last post by:
Hi All, I have an EXE, I load the DLL from that exe in a seperate AppDomain. (I have not given reference to that DLL from the EXE). Now, i call some commands of that dll from the EXE, and in...
4
by: stu_pb | last post by:
I am designing a plugin system for a window application using .NET(C# specifically). One of the requirements of the plugin system is to be able to dynamically load/unload plugins. My initial...
4
by: Chris Lacey | last post by:
Hi, I'm currently writing a scheduling service which starts a number DotNet executables, each within a new AppDomain, every ten seconds. The guts of the code is as follows: // For each...
4
by: Mirano | last post by:
Hi everybody. I load an assembly into another AppDomain, not a default one. As there is no way to unload the assembly, I need to unload the domain. This is where the app hangs. The problem is...
2
by: Lauren Hines | last post by:
Hello, I have read numerous post stating that the only way to unload an assembly (DLL in my case) is to create a separate AppDomain, load the assembly, then unload it by calling AppDomain.Unload....
6
by: Wal Turner | last post by:
Hi there. There are various snippets on forums regarding issues with AppDomain.Unload and how it just doesnt work. Fortunately, I got it working with the base case, after much fiddling. Consider...
22
by: JPSutor | last post by:
when I use the AppDomain.UnLoad method (which calls the Thread.Abort method), I get the following error message AppDomain can not be unloaded because the thread 1378 can not be unwound out of it...
2
by: Tim | last post by:
Hello, I've finally managed to remotely load a DLL. I've expanded the code to load it in a seperate domain to unload the appdomain, which works to a certain extend. The host application always...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.