marshalbyrefobject

C# How to pass Linq in an interface - MarshalByRefObject

我是研究僧i 提交于 2019-12-11 13:29:42
问题 This is a follow up question from here but is of totally different nature. The reason i mention it is because I wanted to provide premise. Basically I'll have a few Datatables (or serialize classes) that will contain over a million rows and will be very hard to return from SQL. So using an example I found I derived a TCP Channelservices utilizing MarshalByRefObject to return the top x rows. However this really isn't powerful enough for what I want to do. I'm curious out of the code below, how

Is it possible to have delegates marshalled as proxies when they are passed across to another AppDomain?

时间秒杀一切 提交于 2019-12-10 11:24:34
问题 Somehow I assumed that delegates passed to another AppDomain would turn into a proxy as if it were an object derived from MarshalByRefObject . Unfortunately, it seems they don’t. Let’s say in my code I have a class MyClass like this: [Serializable] public sealed class MyClass { public Func<Input, Output> SomeDelegate; } [Serializable] public sealed class Input { ... } [Serializable] public sealed class Output { ... } Now I need to pass an instance of MyClass to another AppDomain. The problem

Transparent proxy to original type

十年热恋 提交于 2019-12-07 13:11:00
问题 I have an run time object of type {System.Runtime.Remoting.Proxies.__TransparentProxy} which is created from an instance of class which is inherited from ContextBoundObject. This class raise an event to some other object, I need to convert this proxy object to original object. All objects are in default AppDomain on single system. public abstract class ObjectBase : ContextBoundObject, IObjectBase { } public IMessageSink GetObjectSink(MarshalByRefObject o, IMessageSink next) { _context =

Is it possible to have delegates marshalled as proxies when they are passed across to another AppDomain?

微笑、不失礼 提交于 2019-12-06 14:33:03
Somehow I assumed that delegates passed to another AppDomain would turn into a proxy as if it were an object derived from MarshalByRefObject . Unfortunately, it seems they don’t. Let’s say in my code I have a class MyClass like this: [Serializable] public sealed class MyClass { public Func<Input, Output> SomeDelegate; } [Serializable] public sealed class Input { ... } [Serializable] public sealed class Output { ... } Now I need to pass an instance of MyClass to another AppDomain. The problem is that the delegate stored in SomeDelegate may contain a reference to pretty much any method,

Mixing MarshalByRefObject and Serializable

那年仲夏 提交于 2019-11-30 14:33:10
Various sources explain that When an object derives form MarshalByRefObject, an object reference will be passed from one application domain to another rather than the object itself. When an object is marked with [Serializable], the object will be automatically serialized, transported from one application domain to another and then deserialized to produce an exact copy of the object in the second application domain. Note then that while MarshalByRefObject passes a reference, [Serializable] causes the object to be copied. [source] I'm designing my first app that uses AppDomains and I'm wondering

“Object has been disconnected or does not exist at the server” exception

試著忘記壹切 提交于 2019-11-30 05:50:27
问题 I need to use cross-appdomain calls in my app, and sometimes I have this RemotingException: Object '/2fa53226_da41_42ba_b185_ec7d9c454712/ygiw+xfegmkhdinj7g2kpkhc_7.rem' has been disconnected or does not exist at the server. The target object is still alive, I have checked it. UPD I've set breakpoint in the finalizer of the target object, and it never hits. Thus, this object is alive and wasn't GC'ed. 回答1: That is probably because the local garbage collector at the server side collects the

How do I pass references as method parameters across AppDomains?

痞子三分冷 提交于 2019-11-29 10:07:19
I have been trying to get the following code to work(everything is defined in the same assembly) : namespace SomeApp{ public class A : MarshalByRefObject { public byte[] GetSomeData() { // } } public class B : MarshalByRefObject { private A remoteObj; public void SetA(A remoteObj) { this.remoteObj = remoteObj; } } public class C { A someA = new A(); public void Init() { AppDomain domain = AppDomain.CreateDomain("ChildDomain"); string currentAssemblyPath = Assembly.GetExecutingAssembly().Location; B remoteB = domain.domain.CreateInstanceFromAndUnwrap(currentAssemblyPath,"SomeApp.B") as B;

Accessing a member on Form may cause a runtime exception because it is a field of a marshal-by-reference class

倖福魔咒の 提交于 2019-11-29 09:17:24
Accessing a member on Form may cause a runtime exception because it is a field of a marshal-by-reference class I know what this warning is and know how to solve it. My question is why could this cause a runtime error? You are probably talking about warning CS1690, repro code: public class Remotable : MarshalByRefObject { public int field; } public class Test { public static void Run() { var obj = new Remotable(); // Warning CS1690: Console.WriteLine(obj.field.ToString()); } } In a remoting scenario, the Test.Run method will work with a proxy of the Remotable object. Building a proxy for a

How to solve “Must be MarshalByRefObject” in a good but multiple-inheritance amputated language like C#?

﹥>﹥吖頭↗ 提交于 2019-11-29 09:12:54
How to solve "Must be MarshalByRefObject" in a good but multiple-inheritance amputated language like C#? The problem is very simple, in several cases you just have to inherit from this class (infrastructure requirements). It does not matter here really, which cases. So, what do you do if you've already inherited from some other class (your domain model requirements)? Btw good application frameworks, like spring.net always make sure you DON'T have to inherit from this class no matter what kind of infrastructure you need to apply to your class. I would like to know what am I getting -3 votes

How do I pass references as method parameters across AppDomains?

大憨熊 提交于 2019-11-28 03:25:18
问题 I have been trying to get the following code to work(everything is defined in the same assembly) : namespace SomeApp{ public class A : MarshalByRefObject { public byte[] GetSomeData() { // } } public class B : MarshalByRefObject { private A remoteObj; public void SetA(A remoteObj) { this.remoteObj = remoteObj; } } public class C { A someA = new A(); public void Init() { AppDomain domain = AppDomain.CreateDomain("ChildDomain"); string currentAssemblyPath = Assembly.GetExecutingAssembly()