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? 回答1: You are probably talking about warning CS1690, repro code: public class Remotable : MarshalByRefObject { public int field; } public class Test { public static void Run() { var obj = new Remotable(); // Warning CS1690: Console.WriteLine(obj.field.ToString()); } } In a