473,626 Members | 3,093 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AppDomain and locked assembly

I have a unit test I've written that tests a lot of managed
C++/unmanaged C++/C# interactions. I'm running it under NUnit which
creates a separate AppDomain for the test, runs it, then unloads the
AppDomain.

This works fine but one of my assemblies stays loaded/locked and
prevents the directory from being deleted. The AppDomain unloads fine
and every other DLL and PDB is unloaded correctly.

If I use Process Explorer I can see that there is a file handle open
to the assembly. The DLL is not shown in the list of loaded DLLs
however.
The AppDomain unload call should guarantee that all references to the
DLL are removed, correct? How is it possible that the process can
maintain a handle to an assembly whose AppDomain has been unloaded?

FWIW, I changed one of my DLLs to compile without any managed code
(and without /clr). The problem went away. Compiling it with /clr
but without other code changes causes the problem to come back. I'm
not sure if this is relevant.

-- derek
Nov 22 '05 #1
0 1289

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
338
by: Derek Young | last post by:
I have a unit test I've written that tests a lot of managed C++/unmanaged C++/C# interactions. I'm running it under NUnit which creates a separate AppDomain for the test, runs it, then unloads the AppDomain. This works fine but one of my assemblies stays loaded/locked and prevents the directory from being deleted. The AppDomain unloads fine and every other DLL and PDB is unloaded correctly. If I use Process Explorer I can see that...
8
5081
by: A. Elamiri | last post by:
Hello, I created a small app which acts as a services manager. I basically drop a DLL in a Services folder and set the frequency through the application for how often do I want the code in the assembly to run (scheduler). I created a seperate AppDomain here is the code: .... AppDomainSetup ads = new AppDomainSetup(); string path =
1
2485
by: Cider123 | last post by:
The following is a basic example of how this system works: C:\MyApp\Application1.exe C:\MyApp\MyMonitor.exe In SQL Server, we keep an EXE (Application1.exe) file stored as binary. I read this out of SQL Server into a byte array (through MyMonitor.exe) and then pass to a function for Version.
6
8190
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 this 5 line program: AppDomain domain = AppDomain.CreateDomain("MyDomain"); domain.CreateInstance("TempDLL", "TempDLL.Class1"); MessageBox.Show("try deleting file now"); //cant delete file AppDomain.Unload(domain);
22
3803
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 It seems to take time doing this. If I wait for about 30 seconds, it seems to get unloaded. Any ideas?
0
883
by: John Wright | last post by:
I have the following code that creates a new appDomain and loads an exe using reflection. The problem I have is the exe file I pass in is still locked by the application. I have showcopyfiles = "true" and specified the locations for the appDomain to use. The shadowfiles and the original file is locked when I execute the command tmpAssm = .Load(strApplicationName). Now if I have shadowcopyfiles on, why would setting the assembly to the...
0
1189
by: John Wright | last post by:
I have the following code that creates a new appDomain and loads an exe using reflection. The problem I have is the exe file I pass in is still locked by the application. I have showcopyfiles = "true" and specified the locations for the appDomain to use. The shadowfiles and the original file is locked when I execute the command tmpAssm = .Load(strApplicationName). Now if I have shadowcopyfiles on, why would setting the assembly to the...
0
2010
by: Zeya | last post by:
Situation: Using C#, ASP.Net Requirement: 1. ASP.net application with virtual hosting service. 2. Requires a service that will run every predefined frequency in minutes (2, 30, 100, 10000) defined in web.config and do some data crunching in the database How am I doing this?
4
5337
by: illegal.prime | last post by:
Hi all, I'm getting unexpected results when trying to preload assemblies into an AppDomain I'm creating. Upon creation of the AppDomain - I attach an AssemblyResolve to both my current AppDomain and the new AppDomain I create. I copy all the assemblies/dlls into a new directory and then try loading them all into the new AppDomain using the following: private void LoadAssembliesFromDirectory(AppDomain appDomain, string directory)
2
1421
by: =?Utf-8?B?UGFi?= | last post by:
Hello, I am confused with load assembly in AppDomain. I created ASP Web application, same business logic is realized in custom DLLs, and I need to load ones in my application. If I use ‘Load(assmblyRef)’ method of AppDomain class, assembly is loaded but DLL file locked. I try to read DLL in byte array and load assembly calling Load(byte) method. All are pretty, but in contrast to calling Load(assmblyRef)’ method, calling...
0
8192
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8696
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8358
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7188
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5571
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4195
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.