appdomain

Monovation: Assembly Injection into Live Processes

I read this article by Miguel de Icaza on attaching an assembly into a live mono process. How is this any different to attaching a DLL to a running process? I do this already, but once the DLL is attached, it can't be unloaded without using an AppDomain (which I am trying to avoid). Miguel talks about "patch[ing] running programs", but...

How do I set a static bool in another app domain?

How do I programatically set the value of a static boolean in another app domain? I'm testing an application where I need to change a bool value. Problem is that the bool value exists as a static instance on a type hosted in another app domain. (I'm doing this for test purposes, it won't be used in production code) ...

Passing objects across Appdomains

I am having issues while passing objects across Appdomains.During further investigation I found that the issue is due to the IronPython object not been Serialized. This IronPython object is derived from a .NET base class. The .NET base class is derived from MarshalByRefObj. Let me explain my environment. I have IronPython embedded in my...

AppDomain Creation In .Net

Is there a way we can clone Current Application Domain & its Assembly in to new created domain to execute same piece of code in multiple domain having same dependencies as current domain have. ...

Interaction between multiple AppDomain. Problems with the destruction of singleton-objects.

The problem is the following. There is an application that is at work creating additional AppDomain's and loads there assembly (custom user scripts). In the main application, there are some objects, references to which to transfer ownership to those created AppDomain's. Objects themselves are the MarshalByRefObject, and they are disabl...

Several appdomains calling the same unmanged dll

Our .NET 3.5 C# application creates multiple appdomains. Each appdomain loads the same unmanaged 3rd party dll. This dll reads a configuration file upon initialization. If the configuration changes during runtime, the dll must be unloaded and loaded again. This dll is not in our scope to rewrite correctly. Does each appdomain have acce...

Is it possible to load an assembly targeting a different .NET runtime version in a new app domain?

Hello, I've an application that is based on .NET 2 runtime. I want to add a little bit of support for .NET 4 but don't want to (in the short term), convert the whole application (which is very large) to target .NET 4. I tried the 'obvious' approach of creating an application .config file, having this: <startup useLegacyV2RuntimeActiv...

WCF service Appdomain details

I am reading WCF book.It states that the client can consume service running on same AppDomain or different application Domain. Suppose I am creating a service in IIS localhost. example localhost\TestService\Service.svc (WCFService Website). and my client is in d:\demo\client (windows form) Does it mean client is running on dif...

How do I create an appDomain and run my application in it

I need to create a custom app domain to work around a bug in the .net runtime's default behavior. None of the sample code I've seen online is helpful since I don't know where to place it, or what it needs to replace within my Main() method. ...

Question about how to implement a c# host application with a plugin-like architecture

I want to have an application that works as a Host to many other small applications. Each one of those applications should work as kind of plugin to this main application. I call them plugins not in the sense they add something to the main application, but because they can only work with this Host application as they depend on some of it...

Load Assembly in New AppDomain without loading it in Parent AppDomain

I am attempting to load a dll into a console app and then unload it and delete the file completely. The problem I am having is that the act of loading the dll in its own AppDomain creates a reference in the Parent AppDomain thus not allowing me to destroy the dll file unless I totally shut down the program. Any thoughts on making this co...

Run WPF Application from another assembly

I want to run my wpf application "A" from another assembly "B". I use the following code: static void main() { var app = new A.App(); app.InitializeComponent(); app.Run(); } when i run my app I got the following error: Cannot convert string '/Resources/icon.gif' in attribute 'Icon' to object of type 'System.Windows.Media.Imag...

Can CancellationTokens be used across AppDomains

.NET 4 introduced some types to nicely support cooperative cancellation. I would like to be able to cancel an operation which is running in a different AppDomain. The CancellationToken type is a struct. If I pass it to another AppDomain, will it work as normal? ...

Loading an Isolated dll into existing Appdomain and autoexecuting events

I have a solutions where three projects are running. One of my project is class library that is isolated from other two class. Now what I want to do is to load it into existing appdomain and auto execute its methods on some event occured from other assemblies in same domain. I have an event inside that, and i want to execute that event ...

Best evidence to offer a sandboxed appdomain for a C# evaluator.

I have a c# evaluator which uses the (I think) the .Net 4 new simplified sandboxed appdomain model to host the c# assembly, with remoting doing the rest. The call to create the appdomain is Evidence ev = new Evidence(); ev.AddHostEvidence(new Zone(SecurityZone.Trusted)); PermissionSet pset = SecurityManager.GetSt...

How Do I get the current instance from an AppDomain?

Hi, I use the default appdomain (AD) which I use to create new appdomains (AD1) when required for running plugins in isolation. When creating the new domain I also wire up the AppDomainUnload event to allow me to call clean up code etc. The issue I seem to have is: 1) Create AD1 from AD 2) Run code in AD1 3) Call AD.Unload(AD1) The ...

C#: at design time, how can I reliably determine the type of a variable that is declared using var?

I'm working on a completion (intellisense) facility for C# in emacs. The idea is, if a user types a fragment, then asks for completion via a particular keystroke combination, the completion facility will use .NET reflection to determine the possible completions. Doing this requires that the type of the thing being completed, be know...

Can an appdomain be restricted to one directory?

I am developing a plugin host. The plugins should have as little trust as they need, however I want to have the possibility for a plugin to read and write files. Can the AppDomain where the assembly will be loaded be restricted to have access to only one directory for reading and writing? Other options and ways to go about this are als...

does the object creating a sub appdomain get instantiated in that sub appdomain?

does the object creating a sub appdomain get instantiated in that sub appdomain? I have an object that is in the main AppDomain and it is creating another AppDomain and it requires the calling class to be serializable and is creating an instance of the calling class in the new sub AppDomain. I'm wondering if that is how it is, or if th...

AppDomain.UnhandeledException event not fired

In a WPF application, the app simply crashes, without the above event being fired. (I'm also registered to DispatcherUnhandeledException, which doesn't fire as well.) I conclude that it doesn't fire since the handler is defined to place a log entry. When looking at the log, there's no corresponding entry. It happens in a production en...