New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop Serializable attribute requirement for classes used in RPC #975

Closed
Jand42 opened this Issue Jul 2, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@Jand42
Member

Jand42 commented Jul 2, 2018

Currently if a class is used as RPC result and a base class of it is not marked Serializable but has any fields, it can lead to unexpected runtime errors by the client not getting these field values. Currently an error is given only when the result type itself does not have Serializable. Of course having System.Object as base class should not cause any errors, a good general rule would be is to require having Serializable on classes with any private fields.

Original report: https://forums.websharper.com/topic/85373#85439

@Jand42 Jand42 self-assigned this Jul 5, 2018

@Jand42

This comment has been minimized.

Member

Jand42 commented Jul 5, 2018

Thinking of it, most serializers don't require the Serializable attribute (not XmlSerializer or Newtonsoft.Json), so it is just an extra requirement by WebSharper RPCs with no real benefit. Dropping this check is also an easy way to resolve inconsistent behavior. The NonSerialized attribute will still be respected.

@Jand42 Jand42 changed the title from RPC serializer should fail if a base class without Serializable has fields to Drop Serializable attribute requirement for classes used in RPC Jul 5, 2018

@Jand42 Jand42 closed this Jul 5, 2018

@Tarmil Tarmil added the 4.4.0.280 label Jul 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment