Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Problem setting enum field value using Remoting

Problem setting enum field value using Remoting

Scheduled Pinned Locked Moved .NET (Core and Framework)
helpcsharpdatabasedesignsysadmin
3 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    claughlin
    wrote on last edited by
    #1

    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

    G 1 Reply Last reply
    0
    • C claughlin

      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

      G Offline
      G Offline
      Gerald Leslie Jones
      wrote on last edited by
      #2

      Try using Marshal by value.

      C 1 Reply Last reply
      0
      • G Gerald Leslie Jones

        Try using Marshal by value.

        C Offline
        C Offline
        ClarkLaughlin
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups