Show/Hide Toolbars

XSharp

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

 

This warning occurs when you try to call a method, property, or indexer on a member of a class that derives from MarshalByRefObject, and the member is a value type. Objects that inherit from MarshalByRefObject are typically intended to be marshaled by reference across an application domain. If any code ever attempts to directly access the value-type member of such an object across an application domain, a runtime exception will occur. To resolve the warning, first copy the member into a local variable and call the method on that variable.

 

The following sample generates XS1690:

 

 

// XS1690.prg