appdomain

Deadlock when combining app domain remoting and tasks

泄露秘密 提交于 2020-01-12 04:21:08
问题 My app needs to load plugins into separate app domains and then execute some code inside of them asynchronously. I've written some code to wrap Task in marshallable types: static class RemoteTask { public static async Task<T> ClientComplete<T>(RemoteTask<T> remoteTask, CancellationToken cancellationToken) { T result; using (cancellationToken.Register(remoteTask.Cancel)) { RemoteTaskCompletionSource<T> tcs = new RemoteTaskCompletionSource<T>(); remoteTask.Complete(tcs); result = await tcs.Task

How to use an AppDomain to limit a static class' scope for thread-safe use?

家住魔仙堡 提交于 2020-01-11 02:11:10
问题 I have been bitten by a poorly architected solution. It is not thread safe! I have several shared classes and members in the solution, and during development all was cool... BizTalk has sunk my battle ship. We are using a custom BizTalk Adapter to call my assemblies. The Adapter is calling my code and running things in parallel, so I assume it is using multiple threads all under the same AppDomain. What I would like to do is make my code run under its own AppDomain so the shared problems I

Connect Heroku Application with my GoDaddy Domain [closed]

回眸只為那壹抹淺笑 提交于 2020-01-07 05:26:05
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I've set up a application on Heroku and have also purchased a domain from GoDaddy. I searched on Google how to connect my domain to Heroku and I also read the Heroku documentation but I am not able to connect it with my domain. I am a beginner and have found I need to add cname or domain may be but I don't know

How to debug appdomain return values in VS

梦想与她 提交于 2020-01-04 04:27:05
问题 my c# programm is using multiple appdomains to load/unload assemblies. My assemblies in the 2nd appdomain are returning an object which inherits MarshalByRefObject. My Problem now is that Visual Studio tells me that it can't Show information about it. Obtaining the runtime type of a transparent proxy is not supported in this context. I can see information about this object when I'm in a class of the 2nd appdomain. My question now: is it somehow possible to tell Visual Studio to Show me

Multiple Assembly.Load(Byte[]), same instance or leak?

北战南征 提交于 2020-01-03 17:51:48
问题 What happens when I call Assembly.Load(Byte[]) multiple times with a Byte array containing the same assembly ? Will I get the same instance of Assembly for each call ? The same assembly loaded multiple times within the app domain ??? 回答1: You will get a new Assembly object with each call, read the documentation, there is a note near the end: "Note that this method overload always creates a new Assembly object with its own mapping." 来源: https://stackoverflow.com/questions/1554404/multiple

.NET Portable Class Library [Serializable] Attribute

送分小仙女□ 提交于 2020-01-03 10:47:30
问题 I have a common class library containing many models for my server and my client. Since the client is running under Xamarin, the common library must be a Portable Class Library (PCL). In my server, these objects are passed around with AppDomain Remoting/Marshaling, so to my understanding an object either needs to be marked as [Serializable] or inherit from MarshalByRefObject Being in a PCL, I cannot do either of these things to any of my models. My question is: How can I make these objects

Thread.Abort() method freezes

泪湿孤枕 提交于 2020-01-03 05:40:10
问题 So I've googled that it freezes because of using unsafe code, and AbortException throws only when control flow returns to managed code. So, in my case I have a native library, called in a thread. So sometimes I can't abort it, because the library is native and the Abort method not just do nothing, but freezes the calling thread. So, I'd like to solve it. For example, using a different process should help, but it's very complicated. So, a less heavy solution is to use ' AppDomains' . But

Unload event for the default AppDomain?

橙三吉。 提交于 2020-01-03 03:45:08
问题 I need to have an event fired whenever any AppDomain unloads - including the default one of the process. The problem with AppDomain.DomainUnload is that it only fires for non-default AppDomains. Furthermore, AppDomain.ProcessExit has limited execution time, which I cannot rely on. Any suggestions as to how I can achieve this would be greatly appreciated! (Alternatively, having an event fired when a background thread (Thread.IsBackground == True) works too.) 回答1: Why do you not put your code

AppDomain doesn't make shadow files

亡梦爱人 提交于 2020-01-03 02:01:22
问题 I understand loaded assembly can not be unloaded directly so I created temporary domain and loaded assembly but I got error in creating shadow files. The code I wrote is as follows: [LoaderOptimization(LoaderOptimization.MultiDomainHost)] [STAThread] static void Main(string[] args) { string startupPath = @"D:\Temp\MyLib\bin\Debug"; string cachePath = Path.Combine(startupPath, "__cache"); string assembly = Path.Combine(startupPath, "MyLib.dll"); AppDomainSetup setup = new AppDomainSetup();

AppDomain await async Task prevent SerializationException

放肆的年华 提交于 2020-01-02 04:39:07
问题 I have a windows service, which loads assembly in another AppDomain at runtime. Then it executes them and finally unloads the AppDomain. The problem is the execute method from the plugins are async tasks and I get the SerializationException because Task does not inherit from MarshalByRefObject. I wrapped the plugin in a proxy which inherits from MarshalByRefObject, but I dont know how to get rid of the SerializationException? public interface IPlugin : IDisposable { Guid GUID { get; } string