appdomain

CreateInstanceAndUnwrap and Domain

丶灬走出姿态 提交于 2019-11-30 13:06:37
I have a property whose instance I want to be in other domain. public ModuleLoader Loader { get { if(_loader == null) _loader = (ModuleLoader)myDomain.CreateInstanceAndUnwrap( this.GetType().Assembly.FullName, "ModuleLoader", false, System.Reflection.BindingFlags.CreateInstance, null, null, null, null); System.Diagnostics.Debug.WriteLine("Is proxy={0}", RemotingServices.IsTransparentProxy(_loader)); //writes false _loader.Session = this; return _loader; } } This works fine. But I assume all the method calls on _loader instance will invoke in other domain (myDomain). But when I run following

What are app domains used for?

随声附和 提交于 2019-11-30 11:26:12
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 affect other app domains running in the same process - Does this also hold true for unmanaged / C++ exceptions, possibly even heap corruption or other memory issues. How does inter-AppDomain communication work? How is using AppDomains different from simply spawning

How to pass an unknown type between two .NET AppDomains?

早过忘川 提交于 2019-11-30 10:06:05
I have a .NET application in which assemblies in separate AppDomains must share serialized objects that are passed by value. Both assemblies reference a shared assembly that defines the base class for the server class and also defines the base class for the entiy type that will be passed between domains: public abstract class ServerBase : MarshalByRefObject { public abstract EntityBase GetEntity(); } [Serializable] public abstract class EntityBase { } The server assembly defines the server class and a concrete implemetation of the entity type: public class Server : ServerBase { public override

Restrict plug-in assembly code access

你说的曾经没有我的故事 提交于 2019-11-30 07:32:30
I'd like to create a plug-in architecture where I can limit an assemblies API to something very restricted, i.e. only allow a whitelist of functions. Is it possible to restrict what functions/methods a plug in assembly can call? Can I do it using AppDomains? Does anyone have a simple example? Anderson Imes .NET has added the "Managed Addin Framework" that might fit the bill. It has the following features: Isolation . Plugins run in their own AppDomain if desired, or even their own process if you need that level of isolation. Contractual communication . You setup contracts and this is the only

Copy files over network via file share, user authentication

寵の児 提交于 2019-11-30 06:57:33
I am building a .net C# console program to deploy file to a windows file share server (folder that is being shared). The path is :: \\192.168.0.76\htdocs\public On running I am getting the error: [09:35:29]: [Step 1/3] Unhandled Exception: System.UnauthorizedAccessException: Access to the path '\\192.168.0.76\htdocs\public' is denied. [09:35:29]: [Step 1/3] at DeployFileShare.Program.CopyDir(String source, String dest, String[] exclude, Boolean overwrite) [09:35:29]: [Step 1/3] at DeployFileShare.Program.Deploy(String num, String source) [09:35:29]: [Step 1/3] at DeployFileShare.Program.Main

Can I make the default AppDomain use shadow copies of certain assemblies?

巧了我就是萌 提交于 2019-11-30 06:48:32
问题 A short explanation of why I want to do this: I am busy writing a plugin for Autodesk Revit Architecture 2010. Testing my plugin code is extremly cumbersome, as I have to restart Autodesk for each debug session, manually load a Revit project, click on the Add-Ins tab and then start my plugin. This is just taking too long. I have written a second plugin that hosts an IronPython interpreter. This way, I can play around with the API provided by Revit. But eventually, the code has to be rewritten

“Object has been disconnected or does not exist at the server” exception

試著忘記壹切 提交于 2019-11-30 05:50:27
问题 I need to use cross-appdomain calls in my app, and sometimes I have this RemotingException: Object '/2fa53226_da41_42ba_b185_ec7d9c454712/ygiw+xfegmkhdinj7g2kpkhc_7.rem' has been disconnected or does not exist at the server. The target object is still alive, I have checked it. UPD I've set breakpoint in the finalizer of the target object, and it never hits. Thus, this object is alive and wasn't GC'ed. 回答1: That is probably because the local garbage collector at the server side collects the

Loading 2 versions of assembly at runtime

给你一囗甜甜゛ 提交于 2019-11-30 05:24:43
问题 I've been trying to crack this one over the last couple of weeks and have not found a good solution yet; hopefully I can get an answer here. I have two assemblies (ZA & ZB), both of which point to a common project/dll (ZC) but which could be on a different version (i.e. same dll name, same namespaces, some classes may be different). Each assembly works by itself, however, if one is loaded by the other at runtime (e.g. A loads B), then I cannot get it to work. Need some help. Here's the setup:

Read the content of the string intern pool

最后都变了- 提交于 2019-11-30 04:47:59
问题 I would like to enumerate the strings that are in the string intern pool . That is to say, I want to get the list of all the instances s of string such that: string.IsInterned(s) != null Does anyone know if it's possible? 回答1: Thanks to the advice of @HansPassant, I managed to get the list of string literals in an assembly. Which is extremely close to what I originally wanted. You need to use read assembly meta-data, and enumerate user-strings. This can be done with these three methods of

AppDomain Unload killing Parent AppDomain

∥☆過路亽.° 提交于 2019-11-30 04:15:30
问题 I am having trouble figuring something out about my AppDomain.Unload(...) call. I have a detailed explanation with code from my earlier question. As it turns out, I was performing a couple of steps that apparently, I don't need to. However, I am fairly certain that when an AppDomain is created and then held in a collection: private static Dictionary<string , AppDomain> HostDomains; void StartNewDomain(string domainName) { AppDomain domain = AppDomain.CreateDomain(domainName); HostDomains