Questions tagged [appdomain]

An application domain is an isolated environment in which Microsoft .NET assemblies can be sandboxed, granted specific permissions or PermissionSets and executed.

Definition:

An AppDomain represents an application domain in which compiled Microsoft .NET assemblies can be isolated from other assemblies (either in the root application or other, separate AppDomains). While AppDomains are typically used to sandbox third-party or otherwise untrusted code, they can also be used to separate code from the main process to prevent potential instability in a specific segment of an application.

Tag Usage:

The appdomain tag should be used when referencing issues related to the System.AppDomain class in Microsoft .NET or related remoting or process issues.

Example (C#):

namespace AppDomainExample
{
    using System;
    using System.IO;
    using System.Reflection;
    using System.Security;
    using System.Security.Permissions;
    using System.Security.Policy;

    class Program
    {
        static void Main(string[] args)
        {
            PermissionSet ps = new PermissionSet(PermissionState.None);
            ps.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution));
            ps.AddPermission(new FileIOPermission(FileIOPermissionAccess.Write, @"C:\"));

            var assembly = Assembly.GetExecutingAssembly();

            AppDomainSetup ads = new AppDomainSetup();
            ads.ApplicationBase = Path.GetFullPath(assembly.Location);
            StrongName fullTrustAssemblies = assembly.Evidence.GetHostEvidence<StrongName>();

            AppDomain domain = AppDomain.CreateDomain("foo", null, ads, ps, fullTrustAssemblies);

        }
    }
}
1415 questions
0
votes
0 answers

Inherited form not loaded correctly with designer

My project is a resource file editor. It load an assembly in the appdomain and create all the .resources files from it. Then, it change theses .resources files into .resx files using Resgen.exe. Once the .resx file are created, the windows form…
LolCat
  • 539
  • 1
  • 11
  • 24
0
votes
1 answer

alternative to Remoting when dealing with cross-AppDomain calls

I have a .NET class library which I need to load to a separate domain and execute some code from it. Right now I am using AppDomain.CreateInstanceFrom to create a remoting object and unwrap it using some interface. But what alternatives do I have?…
Bogdan Verbenets
  • 25,686
  • 13
  • 66
  • 119
0
votes
0 answers

AppDomain: Multiple AppDomain, limitations, stackoverflow

As I was searching it states that a single process can have multiple app domains but how many is multiple? Can it be thousands or more than that?
xscape
  • 3,318
  • 9
  • 45
  • 86
0
votes
2 answers

Executing multiple tasks simultaneously in a C# app, each under a separate Windows user account

I am trying to build a C# app that aims to do multiple tasks [e.g. open a file, open a port, spawn a Windows service etc.] simultaneously. Here is what I require:- a) The app should be able to run these tasks at the same time [each initiated through…
Bathla
  • 125
  • 9
0
votes
1 answer

Issues with Fb App Domains and Site URL:

I am trying to integrate facebook connect to all my websites. For example I have a website called example.com and many sub domains like, bob.example.com, claire.second.example.com, swiss.example.com and so on. My objective was to use the…
0
votes
1 answer

C#: AppDomain ShadowCopyDirectories is empty

i'm new in appdomain concept. It stated here that shadow copy creates a copy of the assembly you are referencing but when I check my ShadowCopyDirectories, it is empty. Here's my code: AppDomainSetup sandboxDomainSetup = new…
xscape
  • 3,318
  • 9
  • 45
  • 86
0
votes
1 answer

How to run an executable from memory in another AppDomain?

I tried to find an example of this, but I found nothing. Seems that CreateInstanceAndUnwrap and similar don't have overload for Assembly or byte array. Can someone tell me how to do this? EDIT: Here's link to my other question. My idea was to make a…
blez
  • 4,939
  • 5
  • 50
  • 82
0
votes
1 answer

WCF serviceType as a singleton instance

I've created a Windows Communication Foundation service (the appDomain in this case is a Windows Forms application) that initializes its serviceType class as a singleton: Starting the service works. Making a call from a client works. But if the…
MoSlo
  • 2,780
  • 4
  • 33
  • 37
0
votes
2 answers

Hide a base class method from derived class, but still visible outside of assembly

This is a question about tidyness. The project is already working, I'm satisfied with the design but I have a couple of loose ends that I'd like to tie up. My project has a plugin architecture. The main body of the program dispatches work to the…
Clinton Pierce
  • 12,859
  • 15
  • 62
  • 90
0
votes
1 answer

Minimum-trust AppDomain cross-calling methods in a full trust AppDomain

I have a minimum-trust AppDomain that is calling (across a remoting boundary) methods in a full trust assembly in a full trust AppDomain. However I am getting lots of security exceptions when making these method calls. It would appear that the…
nbevans
  • 7,739
  • 3
  • 27
  • 32
0
votes
1 answer

SerializationException when adding a Windows control to an Excel 2007 Worksheet

I keep getting an exception when adding a control directly to a worksheet. The code is placed inside a form, and is not part of the ribbon. Here is my code: // using TExcel = Microsoft.Office.Tools.Excel; // MyGlobalsWrapper references the Globals…
Dominic Zukiewicz
  • 8,258
  • 8
  • 43
  • 61
0
votes
2 answers

Security and MAF addons

I want to construct a WPF system that can incorporate addin developed by an external developer community. Since I can't vouch for those developers, I want their code to run in a safe environment. It seems that MAF is a good solution, so I decided to…
0
votes
1 answer

UserControl Plugins using System.Add

I know the there is plenty of threads about loading plugins in new app domain. My fault I didn't read them before.. I have this school project - plugin based app, which is almost done. Except one important point - plugins has to be loaded in new…
Gabbo
  • 79
  • 1
  • 2
  • 8
0
votes
1 answer

Create object instance from assembly using AppDomain

I have a class library ClassLibrary1.dll in c:\MyDll\ClassLibrary1.dll with this public class Class1 { public void Run() { Console.WriteLine("Inside Class 1 Library "); } } Using AppDomain how would i create a instance for the…
Gerry
  • 137
  • 1
  • 2
  • 11
0
votes
1 answer

Load Assembly into AppDomain from App.Config

I have a DLL that I need to be a part of the current AppDomain. Is there a way to signal the AppDomain to pick up dlls from some list in the app.config/web.config?
Byron Sommardahl
  • 12,743
  • 15
  • 74
  • 131