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
-1
votes
1 answer

Strange behaviour - Application locking up

i got a problem over here... i have this application, that creates various custom AppDomains, each app domain executes a assembly and its dependencies, like a plugin, a separated assembly, that manipulates database, own resources, etc.. the…
Brizio
  • 31
  • 1
  • 7
-1
votes
1 answer

Why is GetHostEvidence() returning null instead of the expected StrongName?

I am putting together a simple (sandboxed) module system for an application that I am writing in order to allow loading and execution of 'modules' written by others (untrusted code) while locking down permissions (File.IO, etc) to minimize the risk…
Aaron Murray
  • 1,920
  • 3
  • 22
  • 38
-1
votes
2 answers

C# load dll in appdomain recall methods wilhout loadding dll again

I have a consoleapp loading a single dll in a new appdomain and I am able to call a method in that dll. I would like to be able to call that method again without reloading the dll. Preferably I would like to be able to load multiple dlls and call a…
-1
votes
1 answer

static variables inside application domain

I have following classes in the C# Library assembly. public static class TestClass { static int counter = 0; static TestClass() { System.Diagnostics.Debug.Print("TestLibrary.TestClass is constructed..."); } …
Vijay
  • 513
  • 1
  • 6
  • 16
-1
votes
1 answer

Could not load file or assembly but they are loaded

I have a project going on witch uses a DLL from an ERP system. The DLL is used to get information from the ERP, like invoices and such. The error i am getting is: Inner Exception 1: FileNotFoundException: Could not load file or assembly…
-1
votes
1 answer

How to get UI thread dispatcher from other appdomain?

I used to get Dispatcher using Application.Current.Dispatcher in regular WPF applications. But it doesn't work when I try to get it from different AppDomain because Application.Current returns null there.
Matas
  • 820
  • 9
  • 18
-1
votes
1 answer

How to dispose static connections in another AppDomain

I got an windows service application which dynamically loads some other modules in other new appdomain. The problem is they are all using the same static database connections. I can dispose the static connections in the main AppDomain when I…
Mango
  • 11
  • 3
-1
votes
1 answer

how to handle static variables when application (desktop c#) is configured on LAN

I built an c# desktop application for attendance application is working fine when i run it on single machine and all is good.. but now issue is ... my boss want this application should work on LAN and every client can access application from server…
Waqas
  • 847
  • 4
  • 14
  • 36
-1
votes
1 answer

How to force to delete access denied file in c#

In a web application at run-time, i load an external assembly (*.dll file) and run some part of it's code and then i want to unload and delete the file! this is my load code: var assembly =…
Ali Adlavaran
  • 3,697
  • 2
  • 23
  • 47
-1
votes
1 answer

How to get all the static classes from all the loaded assemblies in an app-domain and invoke a static method using reflection

my requirement is as follows, is this possible ? if yes can someone please point me to any resources on this ? get all the assemblies which end with the word "static" from an app domain get hold of the static class which ends with the word …
nen
  • 621
  • 2
  • 10
  • 26
-1
votes
2 answers

How to test Domain is it 'www' domain or subdomain or name server domain or mail domain in python?

I have domain list I want to test are they main domain or sub-domain or nameserver or mailserver: www.domain.com ns1.domain.com mail.domain.com community.domain.com mx.domain.com mx3.domain.com aspmx.l.google.com forums.domain.com and I used…
Tarek Kalaji
  • 2,149
  • 27
  • 30
-1
votes
2 answers

Getting sub-Appdomain cpu usage, memory usage, and thread number in real-time

3-sub appdomain created in a process(main appdomain), and how to get sub-Appdomain cpu usage, memory usage, and the thread number in real-time?
taotao
  • 1
  • 6
-1
votes
1 answer

Keep an assembly alive which is loaded through reflection

I am trying to create a plugin system for my application by defining a common interface and then loading the assemblies dynamically in the current App-domain through reflection. Here is the code for main application: var asm = Assembly.Load(an); var…
Samarsh
  • 565
  • 5
  • 18
-1
votes
1 answer

Simplest AppDomain and FileNotFound exception

I wrote a simple lines of creating separate AppDomain, but getting strange exception of FileNotFound : Could not load file or assembly... Considering necessary parameters are filled , this issue is very confusing to me: AppDomainSetup setup = new…
Shelest
  • 660
  • 8
  • 19
-1
votes
1 answer

Loading assembly in another appdomain from another folder with dependencies

I've found a few variants of this question but it seems mixing all those criterias produces it's own set of errors when you want your assembly loaded In another appdomain From another folder With additional dependencies I need all this to load my…
Ronan Thibaudau
  • 3,413
  • 3
  • 29
  • 78
1 2 3
94
95