.NET 3.5 - System.Reflection.Assembly does not release object (DLL) after use

Hello,

Does anyone of you know how I can force vb.net to remove the handle of a 
local DLL which I used beforehand with Reflection.

Here is a fragment of the code.
I have a base class and a derived class. This app only knows the base class 
and creates an Instance of the derived class by using Reflection which works 
fine. The only problem I have is that the local DLL file is blocked (I can't 
delete it) as long as I don't close the Application

            Dim GetCustomModule as BaseClass
            Dim dll As Assembly = 
Assembly.LoadFrom("c:\tools\DerivedCass.dll")
            For Each assemblytype As System.Type In dll.GetExportedTypes
                If assemblytype.ToString = "tools" Then
                    GetCustomModule = 
DirectCast(Activator.CreateInstance(assemblytype), BaseClass)
                End If
            Next
....
do something with the Class and then get rid of it
....

            dll = Nothing
'now the file c:\tools\DerivedCass.dll is still locked and I can't delete 
it.

Forcing Garbage Collector to run doesn't help at all. I can see through 
Sysinternals\ProcessExplorer that AppName.vshost.exe has still a handle on 
that file.

Thanks for any help
Wolfgang 

0
Wolfixx
4/1/2010 1:20:44 AM
dotnet.languages.vb 830 articles. 0 followers. Follow

2 Replies
1325 Views

Similar Articles

[PageSpeed] 6

Am 01.04.2010 03:20, schrieb Wolfixx:
> Hello,
> 
> Does anyone of you know how I can force vb.net to remove the handle of a 
> local DLL which I used beforehand with Reflection.

Look at the big "Note" in the middle:
http://msdn.microsoft.com/en-us/library/2bh4z9hs.aspx

I've no experience with it but maybe you find something
in the neighbour topics (about assemblies and application domains).

-- 
Armin
0
Armin
4/1/2010 2:16:22 AM

"Armin Zingler" <az.nospam@freenet.de> wrote in message 
news:O$Kj#sY0KHA.776@TK2MSFTNGP04.phx.gbl...
> Am 01.04.2010 03:20, schrieb Wolfixx:
>> Hello,
>>
>> Does anyone of you know how I can force vb.net to remove the handle of a
>> local DLL which I used beforehand with Reflection.
>
> Look at the big "Note" in the middle:
> http://msdn.microsoft.com/en-us/library/2bh4z9hs.aspx
>
> I've no experience with it but maybe you find something
> in the neighbour topics (about assemblies and application domains).
>
> -- 
> Armin

Thanks Armin that seems to be a design limitation then.
Wolfgang 

0
Wolfixx
4/9/2010 4:27:39 AM
Reply:

Similar Artilces:

Ex 2003 SP1 is released
http://www.microsoft.com/exchange/downloads/2003/sp1.asp Anyone tried this yet... any negatives experiences to tell people before installing on their business critical servers? I have installed it a few times, I would recommend you read the release notes, especially if you use OMA -- Mark Fugatt Exchange MVP http://www.exchangetrainer.com http://www.msexchange.org "Adam" <dontuse@email.com> wrote in message news:Xns94FB83A4789E7aacom@194.152.65.250... > http://www.microsoft.com/exchange/downloads/2003/sp1.asp > > Anyone tried this yet... any negatives experience...

check box #3
I want to put some check boxes on my worksheet. When the boxes are checked I want them to be totaled at the end of the column. I inserted the check boxes but when I put the formulas for the sum of the columns I get an error message. I am guessing that I have to make a positive check box = the value of one. Don't have a clue on how to do it. Any help would be appreciated. Dennis You can set up a linked cell for each of the checkboxes. The way you do that depends on the type of checkbox you used. If you used a checkbox from the Forms toolbar, rightclick on it and choose Forma...

using if function..please help
i am trying to use the if function in the following manner. A B apple red apple red grapes purple grapes yellow star n/a if(B1:B5="n/a",0,countif(A1:A5, "star") I want to use this formula not only for 'star' but also for 'apple' and grapes' and many more such fruits which might have n/a later. But, everytime I use this formula it returns a 1..should it not return a 0 for when the value in B is n/a? Please help.. Thank you Are you trying to say that if any c...

XSD/XML -> RDB in .Net
Hello all! Are there available samples or code which can create "create table" SQL statements using provided XSD and/or XML? Is it possible to get create table statements from DataSets / DataTables in ..Net? Any ideas how to approach this? ...

Where to use static constructor and static class
dear friends Can you tell me in which scenario we have to use static class and static constructor? Thanks in advance Ashok kumar wrote: > dear friends > Can you tell me in which scenario we have to use static class and > static constructor? Use a static class when you want to implement functionality that does not require per-instance state (i.e. all consumers of the class can share the state). Use a static constructor when you need to initialize state in a class that is shared by all consumers of the class. Pete ...

Could You Use $10,000 in the Next 30 Days.....Risk Free?
Could you use $10,000 in 30 days Risk-Free? Introducing a revolutionary new downline building system!! Free to join! Build your downline and be in MASSIVE PROFIT BEFORE you spend one single penny! You could be making over $10,000 just 30 days from now! And it's totally Risk-Free!! If you're tired of wasting money trying to make money then you will LOVE this system!! It eliminates every problem in building a downline as it's totally automated and duplicatable by everyone! This is as easy as breathing! So don't waste a second!... You could be just 30 days from Financial Freed...

How do I import my address book from my POP 3 Juno account?
I'm hoping to import my address book from my juno email on the web account to Outlook, and then to export it to my new Hotmail account. I seem to be botching it badly, so far. I was able to save my list to 'Recent Documents'. My efforts to COPY and Paste as an individual 'New Contact' result in partial information and the email address, phone number, etc. are missing. Are there step-by-step instructions to accomplish what should be a relatively easy task? Also, it looks as though Outlook has stripped all of my mail from my juno account. How do I send it b...

Trial Upgrade #3
I am a little confused. I tried Money Plus trial when I went to purchase I purchased Essentials. I downloaded the exe file and installed and put in the key and activated. When I opened Plus a screen opened and asked for ID and password and option of not opening to Internet. When I continued it said that Money can't read file from previous version of money. 1. Did I buy the wrong version 2. If Essentials is fine for me how can I get past the screen "can't read file" Essentials can not read any other version of Money. "Al Tyson" <AlTyson@discussions.microso...

Net Display
Hi All, I have set up my POS with 12" rear displays to display HTML files that I have created from powerpoint pps. I have also attached pictures to some, but not all of my items so that they display relevant promotions or upcoming events when scanned at POS. I have set the net display channel option 'Display each item's picture as it is rung up'. I have two issues with this setup. 1) When I scan item, the picture is displayed. However, the item's picture is displayed on net display until I logon to POS for next transaction. (I MUST have option 'forece Logon for eac...

Discount using two different items?
Hello, I have two different items one sellf for $11.99 and the other for $3.99 is there any way to set it up so that if a customer buys the item for $11.99 that they can get the $3.99 item for $2.99 -- Thank You,; Vince Did you try to setup Mix and Match discount? Jamil. "Vince" wrote: > Hello, I have two different items one sellf for $11.99 and the other for > $3.99 is there any way to set it up so that if a customer buys the item for > $11.99 that they can get the $3.99 item for $2.99 > -- > Thank You,; > Vince ...

Can I use VBA to add cells (over blanks) then do multiplication
I have a Word table in which the last column contains numbers (3 and 4) and some bank cells and I want it add them and put the total into the second last row (7 in this case). The last row contains a multiplier (3) which when applied to the total results in 21. Below is the table. | | | 3 | | | | | | | | 4 | | | | 7 | | | 3 |21| How can I achieve this in VBA (under Word 2003 and 2007) remembering that the user can add rows to the table and the last column can contain blank cells. Thanks in advance for any assistance, Peter Evans Sub ScratchMaco(...

Fractions #3
Hi, Is there anyway to prevent Excel from reducing fractions? For example, I need 2/4 to appear in my spreadsheet, but Excel is reducing it to 1/2. Thanks, V You can create a custom format: <Format> <Cells> <Number> tab, Click on "Fractions", and choose your format. -- HTH, RD --------------------------------------------------------------------------- Please keep all correspondence within the NewsGroup, so all may benefit ! --------------------------------------------------------------------------- "V" <V@discussions.microsoft.com> wrote in ...

Using Hyperlinks within Userforms
Hi all, I have a Userform with various command buttons in place. What I'm trying to do is allow users to be able to open various Word documents when they click on these command buttons via the use of hyperlinks embedded within the click event of each command button. So if they click on one of the command buttons it opens one Word document, and if they click another, it opens the second Word document etc. etc. It would be ideal to have the Userform to always remain displayed, so the documents open in the background, and the Userform always has the focus... then once the desired documents...

Excel sheet (OLE object) sometimes open on the form sometimes in E
Hello there, I have an Excel sheet (OLE object in the table) on a form , I have setup the Property in "Auto Activate" as Double-Click , so when I double click the object the sheet open. But sometime the object appears on the form as an Excel Icon - then when I double click it open in Excel - that is what I want. But sometime it appears as a table of data and when I double click it open on the form - I want to avoid that and instead always have the sheet open in excel. Any idea? Many many thanks, Dan Hi Dan, By default, you can directly double click the OLE Ob...

Doing a VLOOKUP (probably using the INDEX and MATCH function), with both vertical and horizontal values in play.
I am trying to create a function that will pull in data from a 2nd spreadsheet. Typically, I use the index and match function to do so. However, in this case, I am trying to do a lookup based on a value above (i.e., horizontal) and a value to the right (i.e., vertical) of the cell in which the formula will be placed. Additionally, the sheet from which I am pulling is similarly laid out. To Provide an example. Lookup Table Months (horizontal) Jan Feb Mar Apr Etc Names(vertical) Jeff Eric 5 Steve ...

Cannot connect to SQL 2000 AS SP 3 cube from Excel 2000
I have a user who is using Excel 2000 SP 3 to connect to cubes created in SQL 2000 AS SP 3. The user does have permissions to browse to the cube. Originally I could not even connect to the cube itself, nor did I have the OLAP 8.0 provider. I tried all the Office updates, and per a newsgropu tip, I installed the pivot table service (SQL2000 CD \msolap\install\PTS\ptslite.exe). I can connect to the cube from his computer from Excel, but if I create a spreadsheet elsewhere using that cube, his laptop will not open the cube to run queries. Any suggestions? -- *******************...

Air Framing Nailer Kit 8-10 Gauge - 2"
Price:$250.99 Image: http:///image.php?id=B000UFSL5G Best deal: http:///index.php?id=B000UFSL5G Neiko Tools USA 8-10 Gauge 2"~ 3-1/2" Air Framing Nailer Kit * Large Piston For Increasing Power * Stong and Light Weight Die-Cast Body * Drivers Full-Head Nails from 2" to 3-1/2" Long * Includes: Goggles, Oil, Wrenches and Instruction * Max Capacity: 40 pcs * 72-120 psi * Air Inlet: 1/4" NPT * 21 Degree Angle ...

Trouble with bulk import accounts in CRM 3.0
I'm having difficulties with bulk import wizard; I exported contacts from exchange pub folder into a tab separated file, but all I get from the import wizard is an error message “The source import file is corrupt”. I’ve tried a couple of combinations for the separator symbol and tried reducing the number of mapped fields from Outlook but with no results… Any ideas ? I am facing exactly the same problem in importing leads from a tab delimited spreadsheet into MS CRM 3.0. It was EXACTLY the same spreadsheet I have used in MS CRM 1.2 where it worked fine. Any suggestions on what mig...

Date formatting problem #5
Hi there, I've tried everything I can think of with this one - help!! I'm reading dates from 2 cells, storing them in variables, comparing them and then storing the resulting date in a different cell. Code currently is: If stStoredDate<> stDate then stStoredDate=stDate Activecell.Offset(0,1).Value = stStoredDate End If My problem is stStoredDate = 04/09/05 (4 Sep 05 as I'm in the UK), stDate is the same, but the value in the cell is 09/04/05 (9 Apr 05). Both cells have identical formatting. If I change the formatting to 'general', stStoredDate= 38599, but t...

Using a spread sheet for e-mail addresses
I have a large number of e-mail addresses in a spread sheet column. Is there a way to copy the e-mail addresses into the To box (bcc) of an outgoing e-mail without first installing them in my contacts folder? Thanks, Len Urban Save the column as a text file, open the file in Word or your favorite text editor, replace all the line endings with semicolons, and paste it all into the BCC field. -Peter "Len Urban" <lturban@verizon.net> wrote in message news:hgVph.373$9B6.212@trnddc07... >I have a large number of e-mail addresses in a spread sheet column. Is >ther...

Getting Data from another sheet? #3
WHere do I save it to -- bludovic ----------------------------------------------------------------------- bludovico's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1480 View this thread: http://www.excelforum.com/showthread.php?threadid=26722 Hi bludovico The manual is not ready yet (First version of the Add-in) Save the file where you want on your PC. Then in Excel go to Tools>Add-ins.. Browse to the file..OK You see it in the list now (Select it) -- Regards Ron de Bruin http://www.rondebruin.nl "bludovico" <bludovico.1dribg@excelforum-...

reconcile Inventory with General Ledger when using Average Perpetu
The customer wants to have the ability to reconcile their inventory balances with the general ledger accounts when Average costing is being used. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser...

Any one have crm 3.0 installation and config certification dumps
Hi Folks , If Any one have crm 3.0 installation and config certification dumps , Please post it or send to krishna.919@gmail.com Thanks Kris I would hope that most people on this group would take the time to study for these exams and pass them honestly otherwise whats the point? ======================= John O'Donnell Microsoft CRM MVP http://codegallery.gotdotnet.com/crm <krishna.919@gmail.com> wrote in message news:1150431230.275661.283440@g10g2000cwb.googlegroups.com... > Hi Folks , > If Any one have crm 3.0 installation and config certification dumps , > Please...

An Object could not be found??!? Please Help!
I have seen this question asked a few times on Web Forums as well as newsgroups, however it seems that none of the solutions seem to work for me. Here is my scenario. I recently purchased a brand new Dell Server and workstations. The Dell Server is configured as a PDC running Windows Server 2003. The workstations are running Windows XP with Office 2003 installed. The only other software installed on both server and workstations are Symantec Corporate Edition Virus v.7.6, and Exchange Server 2003 on the server. I ran the Exchange Server setup and all seemed to go well. I created a mailbo...

Using the combo box from the forms toobar
When using the combo box from the forms toolbar I get text that is a specified size. I can increase the size of the drop down arrow and box but I can't change the text size. How do I change the text size? Hi R, > When using the combo box from the forms toolbar I get text that is a specified size. I can increase the size of the drop down arrow and box but I can't change the text size. How do I change the text size? You can't. The combo box from the forms toolbar is a fixed font. If you need a different font, you'll have to use the combobox from the control toolbox. Re...