Open ajj7060 opened 7 years ago
There is no Serializable
attribute in Xamarin, so CSLA provides that attribute to help avoid compiler errors, even though the attribute is actually not really used by anything except MobileFormatter
, and even that is a legacy formality.
MobileFormatter
can't serialize an enum however (iirc anyway), so this error should be helpful in informing you that the value can't be serialized by the only serializer supported on Xamarin by CSLA: MobileFormatter
.
Oh, interesting. So how do you serialize enums then? Do we need to store it as an integer backing field?
I'm quite certain we support properties that are of an enum type, but we don't require the enum type itself to be serializable, because what we transfer over the network is the int
representation.
Ah ok, that clears things up then. Sound perfect, thanks!
On the other hand, since our Serializable
attribute is basically just a decoration - if it is causing you issues with x-plat compilation we should probably extend it to support enums too.
Do you want to create a PR to that effect?
Actually that's what I had originally thought, that it was there to help make porting the code easier with one less thing to worry about. I've never used Git before, but I'll attempt to get you a PR tonight.
So I think I got it. Not as easy as branch/commit :-)
If you use the 'GitHub for Windows' app it helps.
We're in the process of porting our business code to be compatible with Xamarin, and I got an unexpected compilation error.
CS0592 Attribute 'Serializable' is not valid on this declaration type. It is only valid on 'class, struct' declarations.
This is the Serializable attribute from Csla's portable library (portable-net45+win8+wpa81). I'm assuming this is a bug as I don't see any reason why Enums shouldn't be able to be marked as Serializable, but wanted to check here before I created a bug issue.