appdomain

Broken tab navigation in popup with WPF user control hosted inside Winforms in default AppDomain

主宰稳场 提交于 2021-02-18 19:54:22
问题 I have a WPF user control that uses a Popup. This control is a plugin and can be loaded in the main AppDomain or in a separate AppDomain, and it is hosted in a Winforms form using ElementHost. When the plugin is loaded in the main AppDomain, and the popup is opened, tabbing between the fields of the popup instead moves focus to the first control of the popup windows parent. When it is loaded in a new AppDomain, the tab behavior works as expected/desired (it cycles through the controls in the

Broken tab navigation in popup with WPF user control hosted inside Winforms in default AppDomain

巧了我就是萌 提交于 2021-02-18 19:53:13
问题 I have a WPF user control that uses a Popup. This control is a plugin and can be loaded in the main AppDomain or in a separate AppDomain, and it is hosted in a Winforms form using ElementHost. When the plugin is loaded in the main AppDomain, and the popup is opened, tabbing between the fields of the popup instead moves focus to the first control of the popup windows parent. When it is loaded in a new AppDomain, the tab behavior works as expected/desired (it cycles through the controls in the

AppDomain.CurrentDomain.UnhandledException in Revit Addin

主宰稳场 提交于 2021-01-28 22:02:25
问题 I wanted to use a crash reporter in my own Revit addin but AppDomain.CurrentDomain.UnhandledException is never called. It seems Revit itself manages the unhandled expections and shows its own crash dialog. What should I do to catch all unhandled exceptions in revit addin before Revit cathes them? I already tried the following lines of code but it does not work: it never enters the handler method: public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) {

AppDomain.AssemblyLoad event catches all exceptions raised within the event handlers

流过昼夜 提交于 2021-01-28 10:47:35
问题 It seems the .NET AppDomain.AssemblyLoad event catches any exceptions thrown within it's event handlers, not propagating them to the caller who triggered the assembly load (e.g. Assembly.LoadFile() ). My first question is why does this catch all exceptions behavior exist? Microsoft are generally pretty strict about ensuring exceptions always propagate in their BCLs. My second question, is there any way to turn off this behavior? Background: I need to scan assemblies as they are loaded and

Code Access Security exception in restricted AppDomain

余生颓废 提交于 2021-01-27 13:43:33
问题 Goal : I need to run some code in an AppDomain with very limited permissions - it should have no access to anything at all fancy or unsafe, except for a few helper methods that I have defined elsewhere. What I've done : I'm creating a sandbox AppDomain with the required basic permissions, and creating a proxy object, which runs the code: static AppDomain CreateSandbox() { var e = new Evidence(); e.AddHostEvidence(new Zone(SecurityZone.Internet)); var ps = SecurityManager.GetStandardSandbox(e)

Unload an AppDomain while using IDisposable

笑着哭i 提交于 2020-06-28 07:08:10
问题 I have a marshalable class that contains a factory method. The factory method can be used to instantiate the class in a test AppDomain. I'm trying to understand whether I can use the class with the using( ... ) dispose pattern. The principle concern for me is whether the test AppDomain is Unloaded -- and when. I've added a static flag to the class that's set when an instance method is invoked. If the appdomain is not unloaded, then I believe this flag should retain it's setting in subsequent

How to share an object across app domains in c# if the class is not serializable

混江龙づ霸主 提交于 2020-05-17 08:49:22
问题 For context, this is a follow-up to this question: How can I reload a class in .net To save the trouble of re-reading that post, my "high-level" problem is I want to do this: while(true) { sleep(naptime); reload_code(); // use magic? do_something_useful(); } Where do_something_useful is compiled separately from the code in the while loop, and reload_code would pick up the latest (compiled) version. I was given a link to another answer on this site, which basically said do_something_useful

C# AppDomain: Execute assembly from entry point

亡梦爱人 提交于 2020-05-13 14:56:28
问题 I am trying to create a Windows sandbox application, building upon the "How to" found here: "https://msdn.microsoft.com/en-us/library/bb763046(v=vs.110).aspx" In the example it loads a specific type from a DLL whereas I would like to be able to execute an assembly from its entry point with restricted permissions. The program I am using for testing purposes is a simple hello world application. using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) {

AppDomain Assembly not found when loaded from byte array

对着背影说爱祢 提交于 2020-02-27 06:42:28
问题 Please bear with me, I spent 30+ hours trying to get this work - but without success. At the start of my program I load an Assembly (dll) in bytearray and delete it afterwards. _myBytes = File.ReadAllBytes(@"D:\Projects\AppDomainTest\plugin.dll"); Later on in the program I create a new Appdomain, load the byte array and enumerate the types. var domain = AppDomain.CreateDomain("plugintest", null, null, null, false); domain.Load(_myBytes); foreach (var ass in domain.GetAssemblies()) { Console

AppDomain Assembly not found when loaded from byte array

旧街凉风 提交于 2020-02-27 06:41:45
问题 Please bear with me, I spent 30+ hours trying to get this work - but without success. At the start of my program I load an Assembly (dll) in bytearray and delete it afterwards. _myBytes = File.ReadAllBytes(@"D:\Projects\AppDomainTest\plugin.dll"); Later on in the program I create a new Appdomain, load the byte array and enumerate the types. var domain = AppDomain.CreateDomain("plugintest", null, null, null, false); domain.Load(_myBytes); foreach (var ass in domain.GetAssemblies()) { Console