PC Review


Reply
Thread Tools Rate Thread

AppDomain Issue

 
 
John Wright
Guest
Posts: n/a
 
      23rd May 2006
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 file
lock it? Any help is appreciated.

John

Private tmpDomain As AppDomain

Public Function LoadProgram(ByVal strApplicationName As String, ByVal
strApplicationEntryPoint As String) As Form

Dim tmpAppDomain As New AppDomainSetup

Dim tmpAssm As Assembly

Dim strName() As String

Dim strVersion As String

tmpAppDomain.ApplicationBase = "d:\wzprograms"

tmpAppDomain.ShadowCopyFiles = "true"

tmpAppDomain.ShadowCopyDirectories = "d:\wzprograms"

tmpAppDomain.PrivateBinPath = "d:\wzprograms"

'set the cache path for shadow files

tmpAppDomain.CachePath = "d:\wzprograms\tmp"

tmpDomain = AppDomain.CreateDomain("Temp", AppDomain.CurrentDomain.Evidence,
tmpAppDomain)

With tmpDomain

'.ExecuteAssembly("D:\wzprograms\versioncheck.exe")

tmpAssm = .Load(strApplicationName)

'.ExecuteAssembly(strApplicationName)

End With

'Get the version of the program

strName = Split(tmpAssm.FullName.ToString, ",")

strVersion = strName(1)

'set up the form to display by calling the Entry Point for the program.

LoadProgram = tmpAssm.CreateInstance(strApplicationEntryPoint, True)

Dim extType As Type = tmpAssm.GetType(strApplicationEntryPoint)

Dim extInfo As MethodInfo = extType.GetMethod("SetProperties")

If extInfo Is Nothing Then

MsgBox("This program cannot be run in the framework.", MsgBoxStyle.Critical,
"Invalid Framework Program")

Exit Function

End If

Dim myParamArray() As Object = {12345}

extInfo.Invoke(LoadProgram, myParamArray)

LoadProgram.Name = ("Test")

LoadProgram.Text = "VersionCheck. " & strVersion

AppDomain.Unload(tmpDomain)

End Function


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
AppDomain Probing issue A. Elamiri Microsoft C# .NET 8 16th Jul 2004 03:19 PM
Repost: Isolation In AppDomain - How to prevent the main AppDomain to crash when another AppDomain Crashes?????? José Joye Microsoft C# .NET 7 6th Nov 2003 02:10 PM
Repost: Isolation In AppDomain - How to prevent the main AppDomain to crash when another AppDomain Crashes?????? José Joye Microsoft Dot NET 7 6th Nov 2003 02:10 PM
AppDomain Issue... Satinderpal Singh Microsoft Dot NET 2 27th Oct 2003 11:19 AM
AppDomain issue... Satinderpal Singh Microsoft Dot NET Framework 0 27th Oct 2003 07:25 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:48 PM.