appdomain

Passing data across appdomains with MarshalByRefObject.

I'm having a little trouble passing some data between two .NET appdomains and I'm hoping someone on here can help me. Basically what I have is a main application (Main) which loads assembly A and B into it's main domain, then when I run a plugin(C) Main calls a create domain method on B which creates a new domain and loads C and a insta...

Determine Child Processes for Thread or Appdomain

I'm using a 3rd party assembly to do some processing, and it spawns 2 child processes to perform some work. I'm running this in a separate thread. I want to be able to cancel the processing if it runs for too long - my problem is that if I abort the thread the spawned processes are still running. Is there a way to determine what proces...

How can I prevent CompileAssemblyFromSource from leaking memory?

I have some C# code which is using CSharpCodeProvider.CompileAssemblyFromSource to create an assembly in memory. After the assembly has been garbage collected, my application uses more memory than it did before creating the assembly. My code is in a ASP.NET web app, but I've duplicated this problem in a WinForm. I'm using System.GC.Ge...

AppDomains and configSections

We are using CSLA (a rather ancient version) in our .NET 3.5 applications, and we make use of it's NetRun application loading for some of our users. For those not familiar with NetRun, NetRun.exe is basically an application "runner" that is installed on user computers (e.g. to c:\Program Files\NetRun\NetRun.exe). The user simply starts...

Abstract base classes and appdomains

I apologize now if my upcoming explanation doesn't make enough sense; I'm reknown for it, though I try to do otherwise. I'm writing a service that makes use of user-defined plugins. I'm trying to isolate them -- keeping their assemblies out of the service's appdomain -- by making use of interfaces defined in a shared assembly. What's ...

Can an assembly be executed or loaded within C#.NET COM component?

I have a COM(written in .NET) which needs to create a an AppDomain and load/execute .NET assemblies in it. So that I could unload that appDomain later along with all loaded dll's. While working OK in normal(e.g. WinForms) .NET app, I get security exceptions if this code runs from within COM context. Assuming that the COM assembly is stro...

.NET: Channel and sinks between unrelated appdomains

I am of the understanding that when a new appdomain is created, the framework creates channels and sinks implicitly. If it didn't, you couldn't create an object in one appdomain and make use of a proxy in the other. (This is an understanding; please correct me if I am wrong.) Additionally, if an object is marshaled for remoting purpos...

Is it possible to enumerate the AppDomains in a remote process?

I have seen this question and a number of blog posts related to using mscoree.CorRuntimeHostClass.EnumDomains method to enumerate the AppDomains within the current process, but I'm wondering if there's a way to enumerate the AppDomains within a separate process on the same machine. I'd like to be able to write a simple console or even W...

Why does AppDomain.Unload() error in finalizer?

Here's some sample code: using System; namespace UnloadFromFinalizer { class Program { static void Main(string[] args) { Program p = new Program(); } AppDomain domain; Program() { this.domain = AppDomain.CreateDomain("MyDomain"); } ~Program...

Application Domain TypeError: Error #1034: Type Coercion failed: error of child domain.

Hello, thanks in advance.. I have a question about a TypeError: Error #1034: Type Coercion failed: error. I'm loading a SWF into my application into a child domain of the parent SWF. I thought this was supposed to allow the 2 SWF's to share the class definitions? var myContext:LoaderContext = new LoaderContext( false, new ApplicationDo...

Building a worker thread pool for a non-thread-safe code

What's the best way to wrap non-thread-safe code in the .net framework? I've got a third-party library that isn't thread safe due to its use of static variables. Rewriting it isn't an option. This library is used by an asp.net web service that receives lots of simultaneous calls. I've currently got it wrapped in a proxy class that uses...

How to make a Type known in one AppDomain, but unknown in another?

Dear ladies and sirs. My question is simple. For unit test purposes, I need a statically compiled type deriving from the Exception type, which is known in one AppDomain, but unknown in another. A straightforward solution would be: To create a subfolder under the directory of the application executable. Place there an assembly with so...

How can one have a dedicated console window per AppDomain in a console .NET application?

Dear ladies and sirs. My console .NET application has several app domains. My wish is simple - console window per app domain. Motivation: The application is actually an MbUnit test assembly and the various app domains are the server hosts all packed in one process, though in different app domains to decrease execution time. Each serve...

AppDomain and native window messages

I have a problem which is also related to AppDomain's and Windows messages. A web page to be hosted in Internet Explorer that would contain a .Net WinForms UserControl derived control - HelloWorldCtl. This control is inside a C# written assembly - HelloWorldControl.dll. The control uses code from another assembly that is written in C++/...

Understanding AppDomains in Windows

I am trying to better understand appDomains. From my understanding Windows runs all applications in a process. each application is encapsulated in it's own object that resides within this process. This object also holds some global varibles which can not be shared. All objects that are in the process can not share any data with one anoth...

Trying to avoid AppDomains

I have a long running C# server application running on Linux/mono, and I have added the ability to load DLL assemblies on the fly to extend the application. I have discovered updating those DLL assemblies at runtime cant be done without using AppDomains, which by the looks of will just get in the way of what I have already done. Sure t...

Is it possible to cause a thread to be created in another app domain?

Let's say I have a non default app domain. I want to get a reference to the Default app domain and cause a thread to be created within it, that runs a piece of code. Is this possible? The only way I can think of doing this is to re-load my assembly into the Default app domain and have some logic in one of the constructors of a type that ...

Is there a way to switch from Fulltrust to PartialTrust at Runtime? (WPF)

I don't want my WPF application to run in Fulltrust but it's impossible to run WPF in a partial trust AppDomain (i tried even with WPF hosting/interop) and WPF Browser Application does not fit my needs, so my question is: is there a way to change the SecurityZone of the current AppDomain at runtime after WPF has created the Window and ...

How to indicate a failed operation without exceptions (multiple appdomains)?

I'm of the understanding that an unhandled exception in any appdomain will bring down that appdomain. This is not unlike an unhandled exception in any standard forms- or console-based application. If that is so, how do you indicate a failed operation when you're crossing appdomain boundaries? I'm currently logging it so that I know it...

Speeding up cross-AppDomain communication

I am trying to execute some logic on multiple AppDomains in parallel. I am doing this because I am working with legacy code which is "un-changeable" and I want to improve performance by parallelizing some things. The problem is that if I run multiple instances within 1 AppDomain they all rely on some static data structures and interfer...