appdomain

Create a WPF “control” that is run in an external process

落花浮王杯 提交于 2019-12-12 09:15:00
问题 I have a WPF app which contains a number of child controls. One of these controls hosts a third party library which underneath the covers runs some native code which throws access violations and crashes the application. Unfortunately removing the library is not an option. What I'd like to do is spin up a new windows process, host the third party library inside that, and somehow communicate with it. Much in the same way that Google Chrome and IE8 handle browser plugins. The issue is that the

Best evidence to offer a sandboxed appdomain for a C# evaluator

情到浓时终转凉″ 提交于 2019-12-12 08:24:17
问题 I have a c# evaluator which uses the (I think) the .Net 4 new simplified sandboxed appdomain model to host the c# assembly, with remoting doing the rest. The call to create the appdomain is Evidence ev = new Evidence(); ev.AddHostEvidence(new Zone(SecurityZone.Trusted)); PermissionSet pset = SecurityManager.GetStandardSandbox(ev); AppDomainSetup ads = new AppDomainSetup(); ads.ApplicationBase = "C:\\Sandbox"; // Create the sandboxed domain. AppDomain sandbox = AppDomain.CreateDomain(

Passing data across appdomains with MarshalByRefObject

旧城冷巷雨未停 提交于 2019-12-12 08:15:47
问题 I'm having a little trouble passing some data between two .NET appdomains and I'm hoping someone on here can help me. Basically what I have is a main application ( Main ) which loads assembly A and B into it's main domain, then when I run a plugin( C ) Main calls a create domain method on B which creates a new domain and loads C and a instance of B into it, so that C can only access B and not the others. B contains a pointer to the IDispatch of Main but only it seems to get it after it is

Azure website constantly restarts due to 'Slow Requests' limit

不问归期 提交于 2019-12-12 08:03:24
问题 I have an azure website setup in West-Europe and in Standard mode. Suddenly today at 30 January 2014 03:00 am UTC it started constantly restart the app pool. The ShutdownReason is HostingEnvironment. I have a lot of these events in eventlog.xml: <Event> <System> <Provider Name="W3SVC-WP"/> <EventID>2299</EventID> <Level>3</Level> <Task>0</Task> <Keywords>Keywords</Keywords> <TimeCreated SystemTime="9:14:50 AM"/> <EventRecordID>15807234</EventRecordID> <Channel>Application</Channel> <Computer

How to properly unload an AppDomain using C#?

蓝咒 提交于 2019-12-12 07:06:45
问题 I have an application that loads external assemblies which I have no control over (similar to a plugin model where other people create and develop assemblies that are used by the main application). It loads them by creating new AppDomains for these assemblies and then when the assemblies are done being used, the main AppDomain unloads them. Currently, it simplistically unloads these assemblies by try { AppDomain.Unload(otherAssemblyDomain); } catch(Exception exception) { // log exception }

Error while loading assembly on separated AppDomain

走远了吗. 提交于 2019-12-12 06:05:34
问题 My application creates multiple AppDomains and I manually configure the binding redirects via the SetConfigurationBytes method. I grab the config file, check for all assemblies installed on the private folder and then set the assemblyRedirect as on the example below. This is to ensure that I'll always use the shipped version of a given assembly: <dependentAssembly> <assemblyIdentity name="System.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /> <bindingRedirect oldVersion="0.0

Asp.net MVC requests in different Application Domains

删除回忆录丶 提交于 2019-12-12 05:08:51
问题 Can anyone explain me how MVC handles requests? I have a MVC Web application, and I had some issues with that until I tried to check in which AppDomain runs each request. There is strange thing(for me) happening that sometimes it creates controller in one AppDomain, sometimes in another. I added AppDomain.CurrentDomain.GetHashCode() to the constructor of the controller and the value is different for different requests.(but not for each request, sometimes the value was already used) It means

Entry point not found in assembly

末鹿安然 提交于 2019-12-12 04:28:50
问题 I have a Application where I need to create AppDomain and Load Assembly into it and execute the methods in the Assembly. Here is my Code public class CreateAppDomain { public void CreateAppDom() { AppDomain domain = AppDomain.CreateDomain("myDomain"); domain.ExecuteAssembly(@"C:\Visual Studio 2005\Projects\A1\A1\bin\Debug\A1.dll"); domain.CreateInstanceFrom(@"C:\Visual Studio 2005\Projects\A1\A1\bin\Debug\A1.dll","A1.Navigate"); } } I above code is written in a classfile called

Different dependency resolution behavior loading assembly in default AppDomain vs new AppDomain

岁酱吖の 提交于 2019-12-12 03:38:53
问题 I've been looking at an issue related to unit testing and managed/native interop via C++/CLI. The details aren't important so I won't fill them in unless asked, but the situation can be distilled as follows: Two assemblies, call them Lib and Dep, exist in the same directory, call it D. Lib depends on Dep via an assembly reference. We are running in an application that lives in a different, unrelated directory. The application creates a new AppDomain with ApplicationBase set to directory D,

CPU and Memory Cap for an AppDomain

故事扮演 提交于 2019-12-12 03:17:27
问题 I want to host an exe in an appdomain and assign a CPU and Memory cap to it so that it does not use more than the assigned processing power. Is this possible to do and how? 回答1: You can't cap the maximum memory directly, as far as I know. However, from .NET 4 on, the memory currently allocated by an AppDomain is available in the AppDomain.MonitoringSurvivedMemorySize property if AppDomain.MonitoringIsEnabled is set to true . You can spin up a watchdog thread to monitor allocations. 回答2: Looks