appdomain

log4net across appdomains

无人久伴 提交于 2019-12-03 11:22:16
问题 I have an application which initializes log4net from one appdomain and needs to use it in another appdomain. Is it supported? If not, should I initialize log4net from each appdomain? Is there a risk in multiple initializations in the same application? Should I use the same log4net.config? 回答1: The log4net-user mailing list has an answer that works with RollingFileAppender. Add the following line to the appender in log4net.config: <lockingModel type="log4net.Appender.FileAppender+MinimalLock"

What are the steps for making domain-neutral assemblies?

这一生的挚爱 提交于 2019-12-03 10:10:52
问题 ...and can those steps also be applied to a 3rd party assembly (that might already be strong-named)? The context for my question should not be important, but I'll share anyway: I'm thinking of making a logger (or log-wrapper) that always knows what "log source" to target, regardless of whether the assemblies using it are in one appdomain, or spread across several appdomains. I think one way to achieve that, is to have a domain-neutral assembly with a static "LogSource" property. If that

Cross-appDomain access to Console.Out

只愿长相守 提交于 2019-12-03 09:04:11
I need to read standart output from application (Core.exe) that runs in the same process but in different appDomain. It's quite easy to redirect output when one deals with process but the appDomains concept is new to me. So.. I start application in isolataed appDomain like that new HostedApp("core", "Core.exe").Run(); class HostedApp { internal string DomainName; internal string AssemblyName; internal AppDomain Ad; internal Thread AppThrd; public HostedApp(string a_domain, string a_assemblyName) { DomainName = a_domain; AssemblyName = a_assemblyName; Ad = AppDomain.CreateDomain(a_domain); }

.Net How to create a custom ThreadPool shared across all the AppDomain of a process?

核能气质少年 提交于 2019-12-03 08:33:05
I made a custom ThreadPool optimized for my specific needs. However, when there are multiple AppDomains in the process, the CLR ThreadPool is able to be shared across all the AppDomains and I would like to be able to reproduce this behavior. This could be done using MarshalByRefObject and Remoting in order to create a distributed ThreadPool, but I fear that it will add unwanted overhead since the key goal of the custom thread pool is performance. Another theoretical solution would be to hack the AppDomain memory boundary using an unmanaged object. If I'm correct, the memory boundary in

AppDomain.Load() fails with FileNotFoundException

谁说胖子不能爱 提交于 2019-12-03 07:50:21
问题 I'm trying to load my plugin dll into separate AppDomain, but Load() method fails with FileNotFoundException. Moreover, it seems like setting PrivateBinPath property of AppDomainSetup has no effect, because in log I see "Initial PrivatePath = NULL". All plugin have strong name. Normally each plugin is stored in [Application startp path]\postplugins\[plugindir] . If I put plugins subdirectories under [Application startp path] directory, everything works. I also have tried to change AppBase

Is AppDomain equivalent to a Process for .NET code?

こ雲淡風輕ζ 提交于 2019-12-03 07:22:42
问题 I have to call some badly written 3rd party COM components that have memory leaks and uses Single Threaded Apartment [STA] within a long running process. I know separate process will be nice way to implement it and I can restart it occasionally from the long running process. Can AppDomain be used instead? Is AppDomain thread a STA thread if marked appropiately? Does it have its own memory for COM objects? Is unloading the AppDomain is equivalent of killing the process? 回答1: An AppDomain does

Does COM interop respect .NET AppDomain boundaries for assembly loading?

拈花ヽ惹草 提交于 2019-12-03 07:03:11
Here's the core problem: I have a .NET application that is using COM interop in a separate AppDomain. The COM stuff seems to be loading assemblies back into the default domain, rather than the AppDomain from which the COM stuff is being called. What I want to know is: is this expected behaviour, or am I doing something wrong to cause these COM related assemblies to be loaded in the wrong AppDomain? Please see a more detailed description of the situation below... The application consists of 3 assemblies: - the main EXE, the entry point of the application. - common.dll, containing just an

What is the scope of finalizer thread - per application domain or per process?

≡放荡痞女 提交于 2019-12-03 06:21:10
Based on all my reading there should be one GC thread to invoke all finalizers. Now, the question is what is the scope of this "one" thread - per process or per application domain, as the whole intention of domains is to separate and make "independent" different applications in one process space. I read here : If an unhandled exception occurs in a finalizer the CLR's executing thread will swallow the exception, treat the finalizer as if it completed normally, remove it from the freachable queue and move onto the next entry. More serious though, is what happens if your finalizer doesn't exit

Sandbox IronPython?

情到浓时终转凉″ 提交于 2019-12-03 06:10:12
问题 Is it possible to run an IronPython interpreter inside my .Net application, but inside a sandbox? I want to deny the IP script access to the filesystem while still allowing the app itself access. Would this involve running the scripting engine in a second AppDomain? How would I handcuff it so it can't do whatever it pleases? 回答1: Here's an article explaining how to create an AppDomain and execute code in a sandbox. Just create the AppDomain and handcuff the code that runs inside it. 来源: https

FileNotFound when load assembly with dependency to another domain

一个人想着一个人 提交于 2019-12-03 05:58:56
I'm trying to make application with plugins. I have MainLib.dll, where I made some commnon interface(let it be ICommon ) with 1 method. Then, I made 2 .dlls(plugins) which have reference to MainLib.dll and implement the ICommon in some classes. Also, I removed all the references in this .dlls exept System . Then, I created an application, which monitors folder ".\\Plugins" and loads all .dlls in newDomain , check if the types in .dll implement ICommon (so this application also reference to MainLib.dll). If yes - add the name of .dll in some list. And now here the problem : before I tried to