appdomain

Using the LoaderOptimizationAttribute on a WCF service

若如初见. 提交于 2019-12-22 17:12:05
问题 I have a wcf service that uses the .net System.AddIns framework to load assemblies into a seperate process and app domain. To improve performance I want to enable the Cross-Domain FastPath. According to the documentation I need to add the LoaderOptimizationAttribute attribute to the main method of my host application. However I do not have a main method as I am using a service. So is it possible to use the attribute? If not then how can I ensure that the addin assemblies are loaded as domain

Executing and then Deleting a DLL in c#

﹥>﹥吖頭↗ 提交于 2019-12-22 14:54:36
问题 I'm creating a self updating app where I have the majority of the code in a seperate DLL. It's command line and will eventually be run on Mono. I'm just trying to get this code to work in C# on windows at the command line. How can I create a c# application that I can delete a supporting dll while its running? AppDomain domain = AppDomain.CreateDomain("MyDomain"); ObjectHandle instance = domain.CreateInstance( "VersionUpdater.Core", "VersionUpdater.Core.VersionInfo"); object unwrap = instance

Long running application slows down

别来无恙 提交于 2019-12-22 11:44:10
问题 There is an application that consists of three executable files. One of them - a dispatcher, which runs other executables. The dispatcher receives a code from an executable at its completion. That is, only the dispatcher is always running, other executables unloads and loads again. The application runs on the point of service and work around the clock. At the first launch the application works fast. At the end of the day, the application works terribly slow. What could be the reason for such

How to check if AppDomain is unloaded?

心已入冬 提交于 2019-12-22 10:07:18
问题 I'm using a bunch of objects in another AppDomain through proxy. They are in a separate domain because I need to hot-swap assemblies that contain those objects, so I Unload an AppDomain after I'm done using the assemblies it's hosting. I want to check sometimes if I've unloaded an AppDomain in the past (or it somehow got unloaded on its own or something) for testing purposes. Is there a way to do this? The obvious way is to do something that would throw an AppDomainUnloadedException , but I'm

AppDomain.Unload throws in Finalizer?

社会主义新天地 提交于 2019-12-22 05:21:59
问题 So here is the story so far, I have this worker thingy which uses an AppDomain to perform some task. The domain is expensive to setup and teardown. So I create a cache per-thread of WeakReference objects to the worker thingy like so: class Worker { [ThreadStatic] static Dictionary<string, WeakReference> _workers; public static Worker Fetch( ... ) { you get the idea } private AppDomain _domain; public Worker(...) { _domain = AppDomain.Create( ... ); } ~Worker() { AppDomain.Unload(_domain); } /

How to gracefully unload a child AppDomain that has threads running

南笙酒味 提交于 2019-12-22 05:05:16
问题 I have a service that loads a child AppDomain and then starts a thread running in it. It needs an AppDomain because it dynamically generates and loads some code and I need to be able to restart it without killing the whole service. So there is a thread running in an event loop in the child AppDomain, it gets events passed to it through a MarshalByRefObject that sticks stuff in a concurrent queue. I want to stop and unload the child AppDomain and create a new one. I can simply call Unload on

Marshalling C++ pointer interface back though C# function call in a non default AppDomain

懵懂的女人 提交于 2019-12-21 20:44:18
问题 I have a working CLI interface between C++ and C# code. The code has a C++ abstract interface like: -------------C++ Interface--------------- namespace cppns { class cppInterface { public: virtual bool Start(const char *pcDir) = 0; }; } ------Implementation of abstract C++ interface in same dll--------- namespace cppns { class cppimp : public cppInterface private: gcroot<MyInternalCSharpClass^> mInternalClassAccess; public: cppimp::cppimp() { mInternalClassAccess = gcnew MyInternalCSharpClass

Runtime callable wrapper (RCW) scope - process or application domain?

瘦欲@ 提交于 2019-12-21 04:42:11
问题 What is the scope of Runtime Callable Wrapper (RCW), when referencing unmanaged COM objects? According to the docs: The runtime creates exactly one RCW for each COM object, regardless of the number of references that exist on that object. If I had to "guess" - this explanation should mean "one per process", but is it really? Any additional documentation will be very welcome. My application runs in its own application domain (it is Outlook addin), and I would like to know what happens if I use

Loading app.config into the AppDomain

偶尔善良 提交于 2019-12-21 03:33:20
问题 I can't get the App.Config file to load into the App Domain. I'm using [System.AppDomain]::CurrentDomain.SetData("APP_CONFIG_FILE", $config_path) from Powershell Calling .NET Assembly that uses App.config but the App.Config file is still not loaded. I've also tried resetting the cache as explained in Using CurrentDomain.SetData("APP_CONFIG_FILE") doesn't work in PowerShell ISE . Here is my test script: $configFile = "{ActualPhysicalPath}\App.Config" gc $configFile Add-Type -AssemblyName

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

岁酱吖の 提交于 2019-12-21 02:43:15
问题 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