appdomain

How do I load an application with dlls from memory into an AppDomain and execute it?

I have several streams with an assembly and its used dlls. How can I load them into an AppDomain and execute the main assembly? I'd rather not save the files to disk if it can be avoided. ...

In .NET, are static constructors called when a new AppDomain is created?

When I create a new AppDomain using AppDomain.CreateDomain in C#, will static constructors be called as asseblies are loaded inside the newly created AppDomain? The assemblies in question have already been loaded into the current domain. ...

How to set Host's Domain Manager in a created AppDomain

I am not sure if this is possible but I would want something similar to loading the Host's domain manager to my new AppDomain. There is no Domain Manager for a newly created AppDomain. Owing to this many of my subsequent call fails. For example if I make a call to "Assembly.GetEntryAssembly" it returns null in the new AppDomain. To wor...

Process-wide "AssemblyLoad" Event

I can receive events, using the AppDomain.AssemblyLoad event, but only for a particular app domain. If I have appdomains that recursively create more appdomains, I believe my AssemblyLoad event will not work for those "grand-child" appdomains. How can I be sure to get an AssemblyLoad event triggered, regardless of what appdomain loaded...

How can I use CodeDOM to create and load an assembly in an AppDomain?

I am working on a project that will use CodeDOM to create a class that evaluates a user-defined expression, creates an assembly for the class, and loads the assembly. Since there can be a fair number of user-defined expressions, I would like to first create an AppDomain, execute the CodeDOM creation/loading and executing for the assembl...

How can in inject a literal expression using Reflection.Emit?

I am working on a project to evaluate tokenized user-defined expressions of varying complexity, using C# as the scripting language. I have a working model using CodeDOM and reflection to generate an evaluator class, create and load the assembly (GenerateInMemory = true), instantiate the class, and Execute the evaluate method. However, ...

why am I getting "error CS0016 : process cannot access ...", when I recompile the dynamically compiled and unloaded dll.

hello, in my application, i use CSharpCodeProvider class to dynamically create a dll file and load the file into another appdomain to use the class in it. when i am done with the class, i simply unload the appdomain. everything is perfect so far. but if i try to recompile the dll at runtime, i get the following error. E:\projects\Com...

Run WPF Application from a Windows Form

I have a problem with a solution that I'm trying to develope. This is my scenario: I have a VB6 application and I would call from this application some WPF windows. I've used the Interop Form Library to define a WinForm like a bridge from VB6 to WPF. The Interop WinForm exposes the methods to start and shutdown the wpf application. To d...

Event not firing through AppDomain

I am having a lot of trouble with AppDomains. I currently have an AppDomain containing camera controls, and am trying to have events raised from this secondary AppDomain (like a picture being taken) come back to the main program. Everything seems to be set up correctly (events are registered, functions will run across domain boundry) but...

Unregister Lease throws InvalidOperationException

I have a application that uses plugins. I load the plugins in another appdomain. I use the RemoteHandle class from http://www.pocketsilicon.com/post/Things-That-Make-My-Life-Hell-Part-1-App-Domains.aspx to keep object from being garbage collected after 5 minutes. This works great as long as my application is running, but when it is shut...

VSTO addin dependency resolution

I have a VSTO addin, which works fine. I am trying to give it a plugin-loading mechanism so that others can add plugins to my plugin. I sounds horrific, I know, but it seems to best option for now. I publish my addin to a folder called 'Published'. This creates the application manifest (Symbols.application) and also a folder called S...

Assembly locking rules and when is shadow copy useful ?

Hello, from what I've understood so far, by reading this doc for instance : http://msdn.microsoft.com/en-us/library/ms404279.aspx, Shadow copy is a feature that allows the use of an assembly while currently loaded by an application. From the above doc : The common language runtime locks an assembly file when the assembly is loaded,...

How to make users have domain name point to their profiles in my site

I want to implement something like Tumblr or Wordpress by giving user the option to have their domain name point to their profiles. For instances user go to their domain registrar and the IP of my server so then: www.usersdomain.com will point to www.mysite.com/userid without actually forwarding so that domain name will still show in the...

Unable to cast transparent proxy to type from AppDomain

I'm trying to create an object in an appdomain: var type = typeof (CompiledTemplate); var obj = (CompiledTemplate) domain.CreateInstanceAndUnwrap ( type.Assembly.FullName, type.FullName); However, I always get the following error: Unable to cast transparent proxy to type 'Mono.TextTemplating.CompiledTemplate'. I'm running on .NE...

Moving data across the appdomain with good performance?

A little background I'm working on an .net application that's uses plugins heavily, the application can request data from the plugins that is then sent back and displayed by the application. First I implemented the plugin framework in MEF but feel that it was a bit limited for my purposes, I wanted to be able to isolate plugins and hav...

Define culture for entire appdomain

I'm creating a windows service that runs multiple threads. Can I set the culture of my entire appDomain, instead of setting it to each thread separately? ...

C# fully trusted assembly with SecuritySafeCritical funciton still throwing SecurityExceptions

I'm trying to create a sandboxed AppDomain for loading extensions/plugins. I have a MarshalByRefObject that in instantiate inside the appdomain to load the dll. I'm getting SecurityExceptions when trying to load the dll and I can't figure out how to get around them while still limiting what the third party code can do. All my projects...

CPU and Memory Cap for an AppDomain

I want to host an exe in an appdomain and assign a CPU and Memory cap to it so that it does not use more than the assigned processing power. Is this possible to do and how? ...

ASP.NET Global/Static storage?

I have a thread-safe object which is part of an API previously used in windows service/client scenarios. This thread-safe object is essentially a singleton and stored in a static variable so that all callers can access the same state. This API has recently started being used in an ASP.NET application, and I suspect that some funky behav...

How does .NET know the dll is the same?

I wrote some sample code like this, all the outputs are the same, which is weird for me, I guess it makes sense if assembly1 is as same as assemly2, since the assembly information is the same(such as name, assembly version, GUID and etc.) however, I changed the assembly information and recompile the SampleCodedFormula.dll(then rename i...