Kittyfisto / SharpRemote

A .NET remoting library
MIT License
12 stars 5 forks source link

SocketEndPoint throws InvalidCastException when reconnected quickly #63

Closed Kittyfisto closed 6 years ago

Kittyfisto commented 6 years ago

It's possible to cause this exception to occur when passing objects marked with the ByReferenceAttribute in conjunction with quickly dropping and re-establishing a connection. It's possible that transient proxies from the old connection are still hanging around (thus not being collected) and if the new connection now creates new sentient proxies, it might re-use ids which are still in use by the old proxies (because used/free id ranges are unfortunately not negotiated between clients) and if the new and old proxies happen to implement different ByReferenceAttribute interfaces, then this exception occurs.