Click here to Skip to main content
15,905,971 members
Home / Discussions / C#
   

C#

 
Questionapp.config Pin
i_martin_r30-Mar-06 10:08
i_martin_r30-Mar-06 10:08 
AnswerRe: app.config Pin
darkelv30-Mar-06 16:04
darkelv30-Mar-06 16:04 
GeneralRe: app.config Pin
AB777130-Mar-06 17:05
AB777130-Mar-06 17:05 
GeneralRe: app.config Pin
darkelv30-Mar-06 19:47
darkelv30-Mar-06 19:47 
GeneralRe: app.config Pin
AB777130-Mar-06 21:57
AB777130-Mar-06 21:57 
GeneralRe: app.config Pin
darkelv30-Mar-06 23:05
darkelv30-Mar-06 23:05 
GeneralRe: app.config Pin
i_martin_r30-Mar-06 22:54
i_martin_r30-Mar-06 22:54 
QuestionI can't modify a dll even though its AppDomain has been unloaded Pin
kayhustle30-Mar-06 9:42
kayhustle30-Mar-06 9:42 
I needed to access an assembly, which I did by loading it into another AppDomain.
Next, I unload the AppDomain. Now when I try to open up that dll for writing it tells me that the file is being used by another process. I thought that the file got unloaded once the AppDomain was unloaded. That is the only reason I loaded the dll into another AppDomain, so that I could unload it and allow it to be overwritten afterward.

Here is my code. The dll is in the directory that the main executable is running in. This is the only way I got the domain to load the assembly. Once the domain loads the assembly a FileStream cannot be opened for writing on that file. It makes no sense because I unload the domain Unsure | :~ :

AppDomainSetup aps = new AppDomainSetup();<br />
           <br />
            aps.ApplicationBase=@"myapplocation";<br />
              AppDomain domain = AppDomain.CreateDomain("My New Domain",null,aps);<br />
            string apploc = @"myexecuting assembly location";<br />
            domain.ExecuteAssembly(apploc);<br />
           <br />
            Assembly ass = domain.Load("AdCenter");<br />
           <br />
            AppDomain.Unload(domain);<br />
           <br />
//The following call throws an exception saying that the file is in use by another process<br />
           FileStream fs = new FileStream("AdCenter.dll", FileMode.Open, FileAccess.ReadWrite);


Thanks

-- modified at 15:59 Thursday 30th March, 2006
AnswerRe: I can't modify a dll even though its AppDomain has been unloaded Pin
Ed.Poore30-Mar-06 11:09
Ed.Poore30-Mar-06 11:09 
AnswerRe: I can't modify a dll even though its AppDomain has been unloaded Pin
leppie30-Mar-06 19:12
leppie30-Mar-06 19:12 
AnswerRe: I can't modify a dll even though its AppDomain has been unloaded Pin
Daniel Grunwald31-Mar-06 1:25
Daniel Grunwald31-Mar-06 1:25 
GeneralRe: I can't modify a dll even though its AppDomain has been unloaded Pin
kayhustle31-Mar-06 4:59
kayhustle31-Mar-06 4:59 
GeneralRe: I can't modify a dll even though its AppDomain has been unloaded Pin
kayhustle31-Mar-06 5:10
kayhustle31-Mar-06 5:10 
QuestionSwapping Forms Pin
KTreanor30-Mar-06 9:03
KTreanor30-Mar-06 9:03 
AnswerRe: Swapping Forms Pin
Ravi Bhavnani30-Mar-06 9:49
professionalRavi Bhavnani30-Mar-06 9:49 
QuestionReceive Net Sends within application Pin
sharmaabhishek30-Mar-06 8:20
sharmaabhishek30-Mar-06 8:20 
AnswerRe: Receive Net Sends within application Pin
Ed.Poore30-Mar-06 8:23
Ed.Poore30-Mar-06 8:23 
GeneralRe: Receive Net Sends within application Pin
sharmaabhishek30-Mar-06 10:56
sharmaabhishek30-Mar-06 10:56 
GeneralRe: Receive Net Sends within application Pin
Ed.Poore30-Mar-06 11:04
Ed.Poore30-Mar-06 11:04 
GeneralRe: Receive Net Sends within application Pin
sharmaabhishek30-Mar-06 11:47
sharmaabhishek30-Mar-06 11:47 
GeneralRe: Receive Net Sends within application Pin
Ed.Poore30-Mar-06 12:11
Ed.Poore30-Mar-06 12:11 
GeneralRe: Receive Net Sends within application Pin
sharmaabhishek30-Mar-06 12:43
sharmaabhishek30-Mar-06 12:43 
GeneralRe: Receive Net Sends within application Pin
kayhustle31-Mar-06 4:13
kayhustle31-Mar-06 4:13 
GeneralRe: Receive Net Sends within application Pin
Ed.Poore31-Mar-06 6:03
Ed.Poore31-Mar-06 6:03 
QuestionControl advice wanted Pin
Small Rat30-Mar-06 7:27
Small Rat30-Mar-06 7:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.