Problem setting enum field value using Remoting
-
I am experiencing a very strange problem while trying to set the value of a public field in a class that is being accessed using .NET remoting. Assuming the following definitions: public enum BuildMethod { DropBox, CVS, } public class BuildInfo : System.MarshalByRefObject { /// public BuildMethod Method; ... } The problem occurs in my client when I am trying to set the value of the Method field of BuildInfo, i.e.: xxxx.Method = BuildMethod.DropBox; There does not appear to be a problem retrieving the value of the Method field, but only when I try to set it. Exception Details: System.Runtime.Remoting.RemotingException: The argument type 1 cannot be converted into parameter type Matrix.Definitions.Schema.BuildMethod. Stack Trace: [RemotingException: The argument type 1 cannot be converted into parameter type Matrix.Definitions.Schema.BuildMethod.] System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +264 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +877 System.Object.FieldSetter(String typeName, String fieldName, Object val) +0 Matrix.ProductMgmt.DeliveryMethodEditor.Save_Click(Object sender, EventArgs e) in D:\Matrix\WebApp\Application\ProductMgmt\DeliveryMethodEditor.ascx.cs:116 System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +108 System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +138 System.Web.UI.Page.ProcessRequestMain() +1277 I am setting up the channel on the server side like this: System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider SinkProvider = new BinaryServerFormatterSinkProvider(); SinkProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; IDictionary props = new Hashtable(); props["port"] = 10782; this.ServiceChannel = new TcpChannel(props, null, SinkProvider); ChannelServices.RegisterChannel(this.ServiceChannel); I am making the object available on the server side using RemotingServices.Marshal(). I would appreciate any help or suggestions that anyone can provide. Thank you, Clark Laughlin
-
I am experiencing a very strange problem while trying to set the value of a public field in a class that is being accessed using .NET remoting. Assuming the following definitions: public enum BuildMethod { DropBox, CVS, } public class BuildInfo : System.MarshalByRefObject { /// public BuildMethod Method; ... } The problem occurs in my client when I am trying to set the value of the Method field of BuildInfo, i.e.: xxxx.Method = BuildMethod.DropBox; There does not appear to be a problem retrieving the value of the Method field, but only when I try to set it. Exception Details: System.Runtime.Remoting.RemotingException: The argument type 1 cannot be converted into parameter type Matrix.Definitions.Schema.BuildMethod. Stack Trace: [RemotingException: The argument type 1 cannot be converted into parameter type Matrix.Definitions.Schema.BuildMethod.] System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +264 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +877 System.Object.FieldSetter(String typeName, String fieldName, Object val) +0 Matrix.ProductMgmt.DeliveryMethodEditor.Save_Click(Object sender, EventArgs e) in D:\Matrix\WebApp\Application\ProductMgmt\DeliveryMethodEditor.ascx.cs:116 System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +108 System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +138 System.Web.UI.Page.ProcessRequestMain() +1277 I am setting up the channel on the server side like this: System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider SinkProvider = new BinaryServerFormatterSinkProvider(); SinkProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; IDictionary props = new Hashtable(); props["port"] = 10782; this.ServiceChannel = new TcpChannel(props, null, SinkProvider); ChannelServices.RegisterChannel(this.ServiceChannel); I am making the object available on the server side using RemotingServices.Marshal(). I would appreciate any help or suggestions that anyone can provide. Thank you, Clark Laughlin
Try using Marshal by value.
-
Try using Marshal by value.
Do you have any more details? I've tried setting SerializableAttribute on the enum. Is there more that is needed? Thank you in advance for your help, Clark L