Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / October 2004

Tip: Looking for answers? Try searching our database.

AppDomain.Unload - Hang

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
uAsking - 19 Oct 2004 15:09 GMT
Ive creates an applicatino that uses worker assemblies to perform functions
when required to communicate to WinCE devices accross various locations
around the UK. When I want the WinCE device to use one of these worker
assemblies, I load it into a new AppDomain and execute the code fine.
Everything is OK.

When I want the application to perform a routine from the application at a
given time fired from a System.Timers.Timer and the AppDomain.Unload is
called the application seems to hang. It's processed in it's own thread but
the finalizer doesn't seem to be called properly. When a
GC.WaitForPendingFinalizers is called just before the AppDomain.Unload the
application hangs completely.

a) Has anyone else had anything similar and how did they solve it
b) Is there a better way of using assemblies dynamically so that if we need
to make a change in one of them we don't have to re-compile the whole
application?

Cheers

Chris
David Levine - 20 Oct 2004 10:59 GMT
What are you doing in the finalizer? The finalizer runs on a separate
thread, and if the thread gets blocked in unmanaged code you are probably
hosed.

> Ive creates an applicatino that uses worker assemblies to perform
> functions
[quoted text clipped - 20 lines]
>
> Chris
uAsking - 20 Oct 2004 13:15 GMT
Well here's the thing. I'm not using finalizers at all, I only put a couple
in to see if they get fired or not. I did a bit more searching and in the
assembly that I am trying to load I only use ADO.NET and a couple of
webservices, and even then the ADO.NET isn't doing very much, just a few
selects and a couple of inserts.

When I run this assembly outside of the calling assembly in a test app it
works fine. It's just when I load it dynamically into the calling assembly.

Another interesting point is that if I put a GC.Wait ForPendingFinalizers in
the called assembly after the webservice call, it hangs, but again when I put
it into a test app with no dynamic assembly loading it works fine and is
removed correctly. I wonder whether it's my lack of understandin when it
comes to assemblies and the garbage collectors and finalizers.

Cheers

> What are you doing in the finalizer? The finalizer runs on a separate
> thread, and if the thread gets blocked in unmanaged code you are probably
[quoted text clipped - 24 lines]
> >
> > Chris
David Levine - 21 Oct 2004 10:31 GMT
I don't have any experience with ADO.NET so I cannot help you there. It
sounds like you are doing something more then what you describe here but
without seeing the actual bits I cannot tell what that might be. If you can
boil this down to a small sample program that duplicate the problem someone
here might be able to assist you.

> Well here's the thing. I'm not using finalizers at all, I only put a
> couple
[quoted text clipped - 47 lines]
>> >
>> > Chris
uAsking - 27 Oct 2004 12:07 GMT
Well a funny one. The problem is caused by the app domain being processed
within a thread or a timer. I don't know what this is a problem but it is.
Once I took the appdomain load / unload out of the thread it solved the
problme. I'm now trying to create work arounds so that it is multithreaded
but then also not by having the unloader work within a seperate process type
thingy. It's all a bit much. I don;t fully understand as it works in a
another thread related to sockt communication, but there we go. I'm not
complaining.

> I don't have any experience with ADO.NET so I cannot help you there. It
> sounds like you are doing something more then what you describe here but
[quoted text clipped - 53 lines]
> >> >
> >> > Chris

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.