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
4
votes
0 answers

How to debug appdomain return values in VS

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…
Tobias Koller
  • 2,116
  • 4
  • 26
  • 46
4
votes
0 answers

Can I override MarshalByRefObject.InitializeLifetimeService in untrusted code?

I have some code for loading an assembly into a sandboxed AppDomain (PermissionSet is initiallized with PermissionState.None). I want to pass data back and forth from my main AppDomain to assemblies in the sandboxed AppDomain. By making my data…
Nogwater
  • 2,777
  • 3
  • 28
  • 28
4
votes
0 answers

Memory leaks when using MarshalByRef in .Net

I've come across an interesting issue, which is really two-fold I guess. I'll try and keep this focused though. I have an environment set up in which an assembly is programmatically compiled and loaded into a child app domain. A class from that…
manderson
  • 544
  • 1
  • 5
  • 19
4
votes
1 answer

How can I find out if an instance is a MarshalByRef proxy?

I know there's a way, I know I've done it (a long time) before, but I can't remember or find out how to do it!!! var otherDomain = AppDomain.Create("Lol my memory sucks"); var myRemotableType = typeof(MyTypeThatExtendsMBRO); var proxy = otherDomain …
user1228
4
votes
1 answer

Can I hook into the expiration of a remoting object?

I have a class which inherits from MarshalByRefObject, and in it I am overriding the lifetime service to give it an InitialLeaseTime of two hours: public override object InitializeLifetimeService() { // Expire after two hours. var lease =…
AndrewL
  • 3,126
  • 5
  • 31
  • 33
4
votes
3 answers

Passing data across appdomains with MarshalByRefObject

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)…
Nathan W
  • 54,475
  • 27
  • 99
  • 146
3
votes
1 answer

Memory leak in simple cross app object

I am experimenting with cross-AppDomain objects, and found one quite strange thing. When I call a remote method, which is allocating a MemoryStream object and returning it's reference (and which is immediately disposed by the caller), memory usage…
aldem
  • 191
  • 11
3
votes
3 answers

Workaround .net application domain only passing objects by value

I am developing an .net application which heavely depends on plugins. The application itself contains an connection to a remote server. Recently I digged into Application domains and see them as the ideal solution for isolating the plugin code from…
Stormenet
  • 25,926
  • 9
  • 53
  • 65
3
votes
1 answer

Creating a local instance of an object being referenced from the AppDomain

Im trying to find out if there is a way to create a local instance of my object that is being referenced from the app domain, reason for this is due to the high amount of chatter I get during all the execution of the method. So instead of having to…
Domitius
  • 475
  • 6
  • 17
3
votes
1 answer

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

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…
Timwi
  • 65,159
  • 33
  • 165
  • 230
3
votes
0 answers

C# Web Cam with Remoting

My project is about Remoting and i want to add a webcam component to it. Here it goes: I have 3 project in my solution... Client, Server, Remote.dll. In Remote.dll is a common class which has methods works in server machine. When i call these…
Guven Sezgin Kurt
  • 1,199
  • 11
  • 13
3
votes
2 answers

How to send nonserializable objects as arguments to a proxy method. MarshalByRefObject wrapper?

I'm am currently revising a plugin architecture so that it utilizes AppDomains. The main difference between my plugins and the many examples I have found online is that instead of the plugin running and sending its results back to the main…
LTAcosta
  • 500
  • 3
  • 9
2
votes
2 answers

How do I detect if a MarshalByRefObject is local or remote?

In other words, how do I tell if I have a reference to a TransparentProxy or a local object?
Qwertie
  • 16,354
  • 20
  • 105
  • 148
2
votes
1 answer

Removing disconnected MarshalByRefObjects from server side lists

In .Net remoting, if one creates a list of remote objects, then if the remote side goes away and you try to access one of the list items you would get an exception. All well and good, you can try catch it, not the end of the world. However, if you…
Dmitry
  • 1,513
  • 1
  • 15
  • 33
2
votes
0 answers

Should classes inheriting from MarshalByRefObject remove such inheritance after migrated to .NET 5+?

Im migrating a WPF app onto .NET5+, and I see some classes have inherited from MarshalByRefObject class. Indeed, im not sure how it was used previously, and I myself have no practical experience using this. I saw InitializeLifetimeService() has been…
Nick W
  • 55
  • 3