Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is MarshalByValueComponent still used or useful?

I have been exploring reinventing the DataTable and I am wondering what the uses are for MarshalByValueComponent. I believe it is used for .NET Remoting (maybe WinForms and WebForms), but that was replaced superseded by WCF. I cannot find any notable usages of it across GitHub or Google. Is MarshalByValueComponent still used?

like image 726
Dustin Kingen Avatar asked Feb 16 '23 17:02

Dustin Kingen


1 Answers

This is hard to answer. The entire concept of wanting to remote a component is a mystifying one. These design decisions were made 13+ years ago and clearly they had a very different idea of how remoting was going to be practical. Which didn't pan out that well, heavily re-engineered in .NET 3.0

Just noodling about this a bit without knowing the thinking behind it. MarshalByValueComponent exist as the antipode to Component. Which inherits from MarshalByRefObject. By far most components and controls are not serializable, they have way too much runtime state associated with them that can never properly deserialize in another runtime environment. Take an OpenFileDialog, the odds that a verbatim copy of it on another machine can operate correctly are zilch. Again having to suspend the wonder at why you'd want to do this at all. Same for any Control, it has dozens of properties whose value depend on the operating system state.

But MBRO isn't that desirable, the many round-trips take a heavy hit from network latency. There are a few components that don't have runtime state and still make a bit of sense in a remoting scenario. That they are a component is in itself a quirk, it's been a long time since I dropped a DataSet on a Form. But they inherit MBVC as a result. Just ignore this, it isn't practical.

like image 113
Hans Passant Avatar answered Feb 28 '23 11:02

Hans Passant