Questions tagged [marshalbyrefobject]

MarshalByRefObject Class enables access to objects across application domain boundaries in applications that support remoting.

MarshalByRefObject is the base class for objects that communicate across application domain boundaries by exchanging messages using a proxy. Objects that do not inherit from MarshalByRefObject are implicitly marshal by value. When a remote application references a marshal by value object, a copy of the object is passed across application domain boundaries.

MarshalByRefObject objects are accessed directly within the boundaries of the local application domain. The first time an application in a remote application domain accesses a MarshalByRefObject, a proxy is passed to the remote application. Subsequent calls on the proxy are marshaled back to the object residing in the local application domain.

http://msdn.microsoft.com/en-us/library/system.marshalbyrefobject.aspx

76 questions
48
votes
7 answers

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

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…
user626528
  • 13,999
  • 30
  • 78
  • 146
19
votes
5 answers

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

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…
Paul Kapustin
  • 3,297
  • 5
  • 35
  • 45
18
votes
4 answers

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

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?
user415789
10
votes
2 answers

How do the In and Out attributes work in .NET?

I have been trying to serialize an array across an AppDomain boundary, using the following code: public int Read(byte[] buffer, int offset, int count) { return base.Read(buffer, offset, count); } As a guess, after noticing the attributes…
g t
  • 7,287
  • 7
  • 50
  • 85
9
votes
3 answers

How do I pass references as method parameters across AppDomains?

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…
Thiago Padilha
  • 4,590
  • 5
  • 44
  • 69
7
votes
1 answer

Does .Net 4 inline MarshalByRefObject methods?

I have some code that relied on methods not being inlined : internal class MyClass : BaseClass { // should not be inlined public void DoSomething(int id) { base.Execute(id); } } public abstract class BaseClass :…
thinkbeforecoding
  • 6,668
  • 1
  • 29
  • 31
6
votes
2 answers

Mixing MarshalByRefObject and Serializable

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…
Qwertie
  • 16,354
  • 20
  • 105
  • 148
6
votes
2 answers

How can I communicate between plugins?

I have a plugin system where I use MarshalByRefObject to create isolated domains per plugin, so users can reload their new versions, as they see fit without having to turn off the main application. Now I have the need to allow a plugin to view which…
Guapo
  • 3,446
  • 9
  • 36
  • 63
6
votes
2 answers

Loading an assembly into an AppDomain outsite of applicationBase C#

So lately I've been working on a project where the application (or executable,whatever you wish to call it) needs to be able to load and unload assemblies not found within the executable's folder at all. (might even be another drive) For the sake of…
Yoraiz0r
  • 96
  • 1
  • 5
5
votes
1 answer

Can JAXB marshal by containment at first then marshal by @XmlIDREF for subsequent references?

I'm wondering if it's possible to annotate my classes so that the first time the marshaller encounters an object, it generates an XML element of the appropriate type, but any subsequent reference to this object by anything else will have an XML…
holic87
  • 791
  • 2
  • 17
  • 29
5
votes
1 answer

Garbage collecting objects crossing AppDomain boundary

When you pass an object that inherits from MarshalByRefObject to a different AppDomain, won't GC.Collect() induced by the AppDomain that created it collect the object, provided that the object is not rooted in either AppDomain by the time…
RanC
  • 233
  • 1
  • 2
  • 9
4
votes
1 answer

How to test if a MarshalByRefObject is valid?

In a VS2010 C# project we have a class derived from a MarshalByRefObject and we use Activator.GetObject to set it. We are using this derived class to talk to a machine across the network. Sometimes the target machine is on and able to be pinged but…
LightLabyrinth
  • 362
  • 3
  • 14
4
votes
2 answers

Unable to cast transparent proxy in a dll when called from PowerShell, but successful in C# console app

I'm attempting to create an open source library that spawn a new AppDomain and runs a PowerShell script in it. I have a static method that takes the name of the powershell file and the name of the AppDomain. The method executes successfully when…
Justin Dearing
  • 14,270
  • 22
  • 88
  • 161
4
votes
2 answers

Transparent proxy to original type

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…
hungryMind
  • 6,931
  • 4
  • 29
  • 45
4
votes
0 answers

C# Remoting (MarshalByRefObject) problem with System.Security.PermissionSet

I have a class that extends MarshalByRefObject class. I create a HTTPChannel, register the ChannelService and while reading and writing the int and string properties everything works fine. My communication class looks like this (please note that…
David Božjak
  • 16,887
  • 18
  • 67
  • 98
1
2 3 4 5 6