code_junkie

Executing a function in an appdomain

Nov 14th, 2011
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. Dim domain As AppDomain = AppDomain.CreateDomain("Executor")
  2. Dim buffer() As Byte = IO.File.ReadAllBytes("c:pathLocator.dll")
  3. Dim asy As Assembly = domain.Load(buffer)
  4. Dim obj As [Object] = asy.CreateInstance("Locator.Place")
  5. Dim method As MethodInfo = obj.GetType.GetMethod("Where")
  6. Dim result as Integer = method.Invoke(obj, New [Object]() { 1 })
  7. AppDomain.Unload(domain)
  8.  
  9. Dim asy As Assembly = domain.Load(buffer)
  10.  
  11. 'Could not load file or assembly 'Place, Version=1.0.0.0, Culture=neutral, PublicKeyToken-null' or one of it's dependencies. The System Cannot find the specified file.'
Add Comment
Please, Sign In to add comment