appdomain

ASP.NET restarts when a folder is created, renamed or deleted.

UPDATE -- process to replicate issue: 1) Create a website project at c:\projects\restart-demo 2) Add default web.config and a dummy aspx page test.aspx 3) Map IIS to point to the root folder c:\projects\restart-demo 4) Monitor application restarts using perfmon, health monitoring, tracking in global.asax Application_End, etc. 5) Req...

.net unit test crashes with "Cannot pass a GCHandle across AppDomains" when called from foreign thread.

I am writing a C# unit test to test C++/CLI functionality that involves threads. The C++/CLI code implements a DirectShow filter, the Windows API for rendering movies. This works thus that I create DirectShow objects, I tell it to run an AVI through my C++/CLI filters, waits until rendering is done, and then exits. My filter has a call...

.Net Are there potential problems when two versions of the same assembly are loaded in one AppDomain?

Hi, We've come up with a strategy to handle backward compatibility when there is a breaking change between two versions. We load the previous version assemblies in the current AppDomain, deserialize some data with the old version types and then convert these into their equivalent in the new version. Are there any pitfalls with this ap...

Multiple AppDomain with Web-based Management Consoles

Hi everyone, I am thinking about a system that is based on plugins. I am going to create my plugins in each AppDomain and talk with them via Name Pipes in WCF. But I also want each of my plugins have some sort of management console in asp.net mvc and one management console for my system. How can I implement such a system? So they are o...

Stopping Application Loop in secondary AppDomain

First off, apologies for the length... I have a Host/Plugin application akin to MAF. We are not using any of the System.Addin or associated namespaces as this is a custom plugin architecture with multiple AppDomains in play. The Host UI (user interface) is running in it's own application loop (AppDomain). When an item in a listview is...

AppDomain Unload killing Parent AppDomain...

I am having trouble figuring something out about my AppDomain.Unload(...) call. I have a detailed explanation with code from my earlier question. As it turns out, I was performing a couple of steps that apparently, I don't need to. However, I am fairly certain that when an AppDomain is created and then held in a collection: private stat...

problem creating a worker app domain in .NET

I am trying to create a worker app domain in C# in VS 2010 to try out the simple sandboxing technique as mentioned here: http://blogs.msdn.com/shawnfa/archive/2005/08/08/449050.aspx My code inside the function Main looks like this: PermissionSet pset = new PermissionSet(PermissionState.None); pset.AddPermission(new SecurityPermission(S...

Acceptable to lock (AppDomain.CurrentDomain)?

I want to enumerate all loaded assemblies in an Asp.NET application, using AppDomain.CurrentDomain.GetAssemblies(). However, when checking the documentation for AppDomain, I find the following statement: Thread Safety Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not gu...

How to unload the default .NET AppDomain from an unmanaged application

Is there a way to unload the default .NET AppDomain from an unmanaged application? I'm using a third party tool called .NET Extender for using .NET assemblies from within Visual FoxPro which allows me to host .NET controls and also make use of .NET classes and methods from within a FoxPro environment. The problem I'm having is that whe...

IIS7: AppDomain isn't recycling when it should?

Hi there, got a weird question for you based on some weird happenings on our site. We have four .DLLs in our ASP.Net solution (ie. managed code in the /bin folder). This morning we updated all four of them, the site was tested and worked fine. This afternoon I uploaded a new version of one of the DLLs, and it took the whole site down, m...

What is a .NET Application Domain?

What is exactly is an Application Domain (AppDomain) and how is it different than a process or thread? ...

Code Example of multiple .NET AppDomains?

From what-is-a-net-application-domain: You can run several application domains in a single process with the same level of isolation that would exist in separate processes, but without incurring the additional overhead of making cross-process calls or switching between processes. I would like to understand more about how/why one wo...

ApplicationManager.CreateObject fails to load assembly in new AppDomain

I'm trying to develop a web application that dispatch (Dispatcher) to multiple versions of another webapp on a per-request basis. To to that end, I'm using ApplicationManager.CreateObject to create new AppDomains running the web app in question, but the new app domains seem to be failing to load the Dispatcher's DLL (and I'm copying the ...

C#/.NET: Is there a way to force all referenced assemblies to be loaded into the app domain?

My projects are set up like this: Project "Definition" Project "Implementation" Project "Consumer" Project "Consumer" references both "Definition" and "Implementation", but does not statically reference any types in "Implementation". When the application starts, Project "Consumer" calls a static method in "Definition", which needs t...

Cross AppDomain Exception serialization

Hi, Given two app domain : in the first, Library1 and CommonLibrary are loaded. In the second Library2 and CommonLibrary are loaded. Library2 defines a Library2Exception that inherit from CommonException (defined in CommonLibrary). When I call, in the first AppDomain, a method on a MarshallByRef of the second AppDomain that throws a Li...

How safe is an AppDomain sandboxed with SecurityPermissionFlag.Execution?

I have a plug-in vector established using System.AddIn that accepts the body of a pre-defined method, munges the method body into boilerplate code, generates the assembly and executes the method. The assembly references System and System.Core and is sandboxed with var pset = new PermissionSet(PermissionState.None); pset.AddPermission(n...

How do I get stdout into mstest output when running in new app domain?

I have been working on test framework, which creates a new app domain to run the tests in. The primary reason being the dll's that we are testing has some horrible code that relies on the dll being located in the app domain path. (No I can't change this code.) The problem that I am having is that my test team is writing a bunch of funct...

Is it possible to tell if an object is running in a different AppDomain?

I want to know if I can tell what appdomain a object was created in. This is for a unit test but also useful general knowledge. I have the following pieces of code (this is example code for illustration). public Foo Create() { AppDomainSetup appDomainSetup = new AppDomainSet { ApplicationBase = @"z:\SomePath" } AppDoma...

AppDomain and MarshalByRefObject life time : how to avoid RemotingException ?

Hi, When a MarshalByRef object is passed from an AppDomain (1) to another (2), if you wait 6 mins before calling a method on it in the second AppDomain (2) you will get a RemotingException : System.Runtime.Remoting.RemotingException: Object [...] has been disconnected or does not exist at the server. Some documentation about t...

Executing untrusted code

Hi, I'm building a C# application which uses plug-ins. The application must guarantee to the user that plug-ins will not do whatever they want on the user machine, and will have less privileges that the application itself (for example, the application can access its own log files, whereas plug-ins cannot). I considered three alternativ...