appdomain

Workaround .net application domain only passing objects by value

Hi *, I am developing an .net application which heavely depends on plugins. The application itself contains an connection to a remote server. Recently I digged into Application domains and see them as the ideal solution for isolating the plugin code from the rest of the application. However there is one big disadvantage which makes m...

How fast is AppDomain creation?

I have just discovered that if generating assemblies via Reflection.Emit, the .NET framework keeps references in a static member that prevents Reflection.Emit classes not to be GC'ed. I cannot use DynamicMethod due to limitations. I also generate a lot of assemblies (incremental compiler of IronScheme) over the course of a program (co...

Using custom performance counters across appdomain recyclyes

I have an ASP.NET application which tracks statistics by creating and writing to custom performance counters. Occasionally, I see in the error logs that indicate that the counters have failed to open because they had already been used in the current process. I presume this is due to my .NET appdomain having been reset within the same w...

How to load only signed assembly to a new AppDomain?

I'm doing a addin system where the main app loads assemblies Addin1.dll and Addin2.dll on runtime in new AppDomain's. However, in case that Addin1.dll is signed (strong name) with my key and Addin2.dll is not, I want to be able to only load Addin1.dll and reject Addin2.dll. I'm suspecting that it needs to be done by setting some parame...

Message Pumps and AppDomains

I have a a C# (FFx 3.5) application that loads DLLs as plug-ins. These plug-ins are loaded in separate AppDomains (for lots of good reasons, and this architecture cannot change). This is all well and good. I now have a requirement to show a Dialog from one of those plug-ins. Bear in mind that I cannot return the dialog Form to the ma...

Are AppDomains are created for every request?

In ASP.NET 3.5 (with IIS6), are AppDomains are created for every request? I know that all applications have their own AppDomain under w3wp.exe, but how exactly does the whole AppDomain work? I was arguing today with a colleague who was trying to convince me that if an ASP.NET application has a static object (or Singleton class), that th...

Is it possible to run ASP.NET MVC routes in different AppDomains?

I am having problems with thinking up a solution for the following. I got a blog which I recently upgraded from web forms to MVC. The blog is avalible in both swedish and english on two different domains and are running in the same web site in IIS. The problem is that I would like language specific urls on the both sites, like this: En...

How do I implement .net plugins without using AppDomains?

Problem statement: Implement a plug-in system that allows the associated assemblies to be overwritten (avoid file locking). In .Net, specific assemblies may not be unloaded, only entire AppDomains may be unloaded. I'm posting this because when I was trying to solve the problem, every solution made reference to using multiple AppDomains....

Type.IsSubclassOf() doesn't work across AppDomains?

I'm having some problems with the following code: private class ClientPluginLoader : MarshalByRefObject { public bool IsPluginAssembly(string filename) { AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += new ResolveEventHandler(CurrentDomainReflectionOnlyAssemblyResolve); Assembly asm = Assembly.Reflectio...

Executing a function in an appdomain

Given a .NET DLL that consists of a class "Place" and a function "Where" that returns an integer; I need to load the dll into an application domain, execute the function and unload the application domain. Dim domain As AppDomain = AppDomain.CreateDomain("Executor") Dim buffer() As Byte = IO.File.ReadAllBytes("c:\path\Locato...

What are the issues with running WPF across multiple AppDomains on one UI thread?

We are looking at creating a WPF UI that runs across multiple AppDomains. One of the app domains would run the application while the remaining AppDomains would host a series of user controls and logic. The idea, of course, is to sandbox these User Controls and the logic away from the main application. Here is an example of doing this us...

Use the [Serializable] attribute or subclassing from MarshalByRefObject?

I'd like to use an object across AppDomains. For this I can use the [Serializeable] attribute: [Serializable] class MyClass { public string GetSomeString() { return "someString" } } Or subclass from MarshalByRefObject: class MyClass: MarshalByRefObject { public string GetSomeString() { return "someString" } } In both cases...

I don't understand Application Domains

.NET has this concept of Application Domains which from what I understand can be used to load an assembly into memory. I've done some research on Application Domains as well as go to my local book store for some additional knowledge on this subject matter but it seems very scarce. All I know that I can do with Application Domains is to ...

Running C++ code through NUnit

Hello, I have tried to use NUnit to test C# code the is already connected to C++ code (without the NUnit the application work perfectly). In my test I run the main function through AppDomain.CurrentDomain.ExecuteAssembly(..), However when the C# code tries to "communicate" with the C++ it throws an exception and the test crashes. The ex...

Reflection & Application Design

Hello, Let me describe the problem and the solution i currently have and maybe you can help enlighten me on why it's a bad idea (assuming it is) and what i can do to make it a better system. right now i have 600 "rippers" that parse files and rip them to csv or other formats. the rippers all implement a common interface and base class....

IsolatedStorage, trying to demonstrate the different isolation levels - can't for domain isolation

I've edited and trimmed this to try and get it closed because the site is prompting me to accept an answer or add a bounty. I did an experiment which had calls to GetUserStoreForAssembly and GetUserStoreForDomain in a library referenced by a console app but didn't understand why I was getting more stores than I expected in one case and...

How to Load assembly to AppDomain with all references recursively?

I want to load to new AppDomin some assembly which has a complex references tree (MyDll.dll -> Microsoft.Office.Interop.Excel.dll -> Microsoft.Vbe.Interop.dll -> Office.dll -> stdole.dll) As far as I understood, when an assembly is been loaded to AppDomain, it's references would not be loaded automatically, and I have to load them manua...

AppDomain.CreateInstance

When we used AppDomain.CreateInstance("Assembly name", Type name) and my class inherits from MarshalByRefObject what happen internally? Is it create a TransparetnProxy? Code: class Greet : MarshalByRefObejct { ... } class test { public static void Main(string[] args) { AppDomain ad = AppDomain.CreateDomain("Second"); Objec...

Using an AppDomain to instantiate a class in a DLL

I have a website that on user-demand compiles a class on the fly and deposits the dll(named Equation.dll) in a subdirectory of the website. The administrator can recompile at any time. However, once an instance of the class has been created, the message "The process cannot access the file because it is being used by another process" is...

Speeding up ASP.NET development

We're developing web applications using DotNetNuke as a framework and our custom modules for required functionality. The problem is, that it takes a long time for the website to load when you do any changes to code. I'm looking at up to 1 minute for each restart, which really is painfully slow. This leads to very slow develop-rebuild-tes...