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

C# Process.Start is messing with URI's inside a batch file

This is just a quick question that I am sure someone will be able to answer quickly as I am most likely just missing something. Lets say I have the following directory layout Folder1 -> CurrentlyRunning.EXE -> Folder2 ProcessToStart.Bat …
Landin Martens
  • 3,283
  • 12
  • 43
  • 61
0
votes
2 answers

How to completely reset a c# app in code?

I have an app with login/logout functionality. When the user logs out, I want to completely reset all classes and variables (I use static classes so this makes the problem even harder). I have decided that its best to just leave the resetting and do…
bluebit
  • 2,987
  • 7
  • 34
  • 42
0
votes
1 answer

appdomain c++ c#

when we write Assembly asm = AppDomain.CurrentDomain.Load(SomeByteArray); when SomeByteArray read from .net .exe all is ok, and when from c++, error. for this function is important using .net exe ? if yes please other way to do this. thanks
Armen Khachatryan
  • 831
  • 3
  • 22
  • 37
0
votes
2 answers

How to set App.Config from the Network share

Is there way to set the App.Config file from the network share instead of providing it from the same directory where the .EXE is running. For example, Can I do something like this : …
Shiva
  • 1,379
  • 1
  • 15
  • 32
0
votes
2 answers

How to load a dll in an AppDomain with different NET version

I have some third party assembly which was build using Net 2.0. Although I can of course reference that assembly in net 4, running the app results in all kinds of strange errors. So I though loading it in a separate application domain will fix the…
user1029883
  • 695
  • 7
  • 21
0
votes
1 answer

visual studio addon versioning / loadin addon in different app domain

I have an addon to visual studio 2010 for our internal purposes. The addon uses 2 libraries we commonly use, but they change time to time. After the studio starts, it loads the libraries into its application domain. the problem comes when you need…
0
votes
1 answer

Can't access ClickOnce Data directory when not network deployed

I'm testing my clickonce deployment (WPF, .Net 4) and I can't seem to access the data directory. The application is installed and can run offline so I need a way to access the data directory when !ApplicationDeployment.IsNetworkDeployed My manifest…
Chris Klepeis
  • 9,783
  • 16
  • 83
  • 149
0
votes
1 answer

WPF ClickOnce full trust issue (related to separate AppDomain?)

I'm working on creating a clickonce install for my application. I have ClickOnce security settings enabled with full trust in the Security tab if the project properties. I publish to a network drive and run the install. The install is successful but…
Chris Klepeis
  • 9,783
  • 16
  • 83
  • 149
0
votes
2 answers

How to see which classes have been loaded in .Net

Is there a simple way to see for a running .Net application, all the classes that have been loaded so far? This would be helpful in removing classes that are no longer being used in a large project. I know I could put static initializers in every…
nganju
  • 720
  • 6
  • 16
0
votes
1 answer

Assembly.CreateInstance with different assembly references

I've created a plugin architecture that supports reloading of the plugins and doesn't use multiple AppDomains. I simply create a new assembly, when the dll changes, with the Assembly.Load(Byte[]) method and then create the plugin instance via…
lukebuehler
  • 4,061
  • 2
  • 24
  • 28
0
votes
1 answer

Problems with AppDomain and used DLL after unload

I've a problem that a DLL loaded to my new Appdomain is also loaded to the main appdomain! I have a class "Servicebase" which inherits from MarshalByRefObject. Now I have different child classes which inherit from this base class. These child…
Jochen Kühner
  • 1,385
  • 2
  • 18
  • 43
0
votes
1 answer

Unable to load assembly in new appDomain

I have an mvc3 application. I have a subfolder in my application project called "Plugins" All of the dll's stored in that folder should be updateable during runtime, so then we an put down the appdomain and reload the new version of the dlls, so I…
0
votes
1 answer

Who is responsible for running multiple AppDomains in the same process?

I understand that multiple applications can run inside different AppDomains within the same process, and my question is: who is responsible for doing so, would the operating system do this on certain conditions, or is it the sole responsibility of…
Ibrahim Najjar
  • 19,178
  • 4
  • 69
  • 95
0
votes
1 answer

cross-AppDomain event issues

I use the following helper class with POS for .Net to get a reference to the hardware in a separate AppDomain (getting around some limitations of requiring public static class PosHelper { private…
Chris Klepeis
  • 9,783
  • 16
  • 83
  • 149
0
votes
2 answers

Load Assembly in AppDomain and Invoke Entry Point

I'm having the hardest time with this. I've googled for hours, and been to many different questions on here, but I just can't get it. static void Main(string[] args) { AppDomainSetup domainSetup = new AppDomainSetup { PrivateBinPath =…
Banksy
  • 51
  • 2
  • 6