appdomain

Pass and execute delegate in separate AppDomain

I want to exceute some piece of code in separate AppDomain with delegate. How can I do this? UPD1: some more details about my problem My program processing some data (one iteration is: get some data from DB, evaluate it and create assemblies at runtime, execute dynamic assemblies and write results to DB). Current solution: each iterat...

.NET: Load two version of the same DLL

I need to load two versions of the same DLL in order to compare their outputs. I assume that I can use AppDomains for this, but I need some guidence. ...

AppDomain.CreateInstanceAndUnwrap fails if library's name has been changed

Greetings, I have an application that allows users to import libraries (.NET DLLs) they've created, as long as the library conforms to specific guidelines I've given them (use my namespace, decorate methods with my attribute, etc.). I copy each user lib to an internal directory and then load it into its own app domain (so user can unloa...

Passing IEnumerable across appdomain boundaries

Is it generally a bad idea to pass an IEnumerable across appdomain boundaries? I ask because with my current understanding of IEnumerable implementations, the enumerator isn't going to be used until the collection is, well, enumerated. When you are crossing appdomain boundaries, particularly involving multiple processes, would this not...

Questions About Asp.NET and IIS

Hi Everyone, Can you help me thru these questions : Application Pool may contain multiple worker processes (w3wp.exe) ? Application Pool may contain multiple Asp.NET Applications ? Asp.NET assigns one ThreadPool per AppDomain ? One AppDomain only contain one Web Application Instance but Application can contain multiple AppDomains ? ...

How to load an assembly into different AppDomain on Windows Mobile (.NET CF) ?

How to load an assembly into different AppDomain on Windows Mobile (.NET CF) for subsequent AppDomain unload ? ...

CreateInstance of a Type in another AppDomain

My scenario is that I have a .net application (let's say a Console App) that creates AppDomains. It then needs to create instances and call methods on Types that are in that AppDomain. Each AppDomain has a specific directory where are it's dependecies should be, which is not under (or even near) the Console Apps directory. Here's my s...

Prevent ASP.Net AppDomain Unload

As described here, I'm writing a WinForms GUI that is run in an ASP.Net AppDomain. However, whenever Web.config or the bin folder is modified, ASP.Net unloads the AppDomain, and the entire program dies. Is there any way to prevent this? 2nd EDIT: In my EXE, I create the AppDomain by calling ApplicationHost.CreateApplicationHost and pa...

How to prevent AppDomain recycles in IIS 7.0 when deleting a sub directory?

I have an asp.net web application that allows users to upload files to an 'uploads' directory that is located in the same virtual directory as the web app. Each uploaded file goes into a temporary sub directory that is named after the user's session id. Once I'm finished with the files, I delete the temp sub directory. The only problem i...

How can I switch .NET assembly for execution of one method ?

I have different versions of dlls for my .NET application and most of the time I want to use the latest one. However, there is one method which I run on a separate thread where I need to be able to select an older version of the dll based on some criteria. I have learned that it is not possible to just load an assembly and then unload i...

Remoting: Finding client AppDomain / Assembly from server AppDomain

Hello, I have an application with a server "AppDomain", which accepts calls from separate AppDomains (which host plugins, developed by other people and not trustworthy). From the server AppDomain, I need to know which "Plugin" (AppDomain) is actually making the call, so that I can ensure that this plugin has access to the resource. I ...

Loading/Unloading assembly in different AppDomain

Hey there I need to execute a method in an assembly loaded during runtime. Now I want to unload those loaded assemblies after the method call. I know that I need a new AppDomain so I can unload the libraries. But here, the problem arises. The assemblies going to load are plugins in my plugin framework. They have no entry point at all. ...

Single stream, multiple XmlWriters

Is it possible to have a single stream and have more than one XmlWriter write to that stream and end up with well-formed XML? I have an object hierarchy in which each object is solely and fully responsible for serializing itself. My latest attempt has been to create a stream at the highest level, then pass that stream reference down an...

Can you modify the web.config and NOT restart the ASP.NET application?

Possible Duplicate: How to prevent an ASP.NET application restarting when the web.config is modified? Was just thinking about uptime. Thanks. ...

AppDomain for loading plugins changing when writing to network??

I wrote a plugin loader that sets up a new AppDomain and loads the plugins from a directory inside the main application folder. The plugins write out various types of files to a given directory when requested. Everything seems to be working fine, but when some users try and write to a valid network path, we're seeing errors in loading ...

Sharing data between AppDomains

I have a process that can have multiple AppDomains. Each AppDomain collect some statistics. After a specified time, I want to accumulate these statistic and save them into a file. One way to do this is Remoting, which I want to avoid. The only other technique I have in mind is to save each AppDomain's data in a file, and after a speci...

What are app domains used for?

I understand roughly what an AppDomain is, however I don't fully understand the uses for an AppDomain. I'm involved in a large server based C# / C++ application and I'm wondering how using AppDomains could improve stability / security / performance. In particular: I understand that a fault or fatal exception in one domain does not a...

Is there a quicker/better way to get Methods that have attribute applied in C#

I have a marker interface something like this: [AttributeUsage(AttributeTargets.Method, AllowMultiple=false, Inherited=true)] public class MyAttribute : Attribute { } And i want to apply it to methods on different classes in different assemblies... Then I want to Get a MethodInfo for all methods that have this attribute applied. I ne...

Strange SerializationException for Enum in AppDomain

I am getting a SerializationException for an enum when calling from one AppDomain into another: System.Runtime.Serialization.SerializationException: Type is not resolved for member 'Dummy.MyEnum,Dummy, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Sample code: public enum MyEnum { A = 0, B = 1, C ...

Process and AppDomain load/unload...

If I instance a new Process in which I then create a new AppDomain, I'm wondering what is the safest way to end the Process. Should I: AppDomain.Unload(myAppDomain) Process.Close() OR Process.Dispose(), then Process.Close() ...