{"action":"created","issue":{"url":"https://api.github.com/repos/MarimerLLC/cslaforum/issues/320","repository_url":"https://api.github.com/repos/MarimerLLC/cslaforum","labels_url":"https://api.github.com/repos/MarimerLLC/cslaforum/issues/320/labels{/name}","comments_url":"https://api.github.com/repos/MarimerLLC/cslaforum/issues/320/comments","events_url":"https://api.github.com/repos/MarimerLLC/cslaforum/issues/320/events","html_url":"https://github.com/MarimerLLC/cslaforum/issues/320","id":207832153,"number":320,"title":"Confused about the mobile formatter","user":{"login":"ajj7060","id":1903891,"avatar_url":"https://avatars.githubusercontent.com/u/1903891?v=3","gravatar_id":"","url":"https://api.github.com/users/ajj7060","html_url":"https://github.com/ajj7060","followers_url":"https://api.github.com/users/ajj7060/followers","following_url":"https://api.github.com/users/ajj7060/following{/other_user}","gists_url":"https://api.github.com/users/ajj7060/gists{/gist_id}","starred_url":"https://api.github.com/users/ajj7060/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajj7060/subscriptions","organizations_url":"https://api.github.com/users/ajj7060/orgs","repos_url":"https://api.github.com/users/ajj7060/repos","events_url":"https://api.github.com/users/ajj7060/events{/privacy}","received_events_url":"https://api.github.com/users/ajj7060/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-02-15T15:15:18Z","updated_at":"2017-02-23T15:11:51Z","closed_at":null,"body":"We're working on porting our business library to Xamarin for our mobile app support (in addition to supporting our main WinForms application) and I'm hitting an issue with serialization which I'm not sure how to solve.\r\n\r\nMy understanding is that Csla will automatically use the MobileFormatter on Xamarin (including UWP), and we're using HttpProxy.  On the server side it seems that serializing the response to one of our command objects is failing.  \r\n\r\nThis is the exception:\r\n```\r\nType 'Library.ReadOnlyObject' with data contract name 'ReadOnlyObject:http://schemas.datacontract.org/2004/07/Library' is not expected. Consider using a DataContractResolver if you are using DataContractSerializer or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to the serializer.\r\n\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeAndVerifyType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, Boolean verifyKnownType, RuntimeTypeHandle declaredTypeHandle, Type declaredType)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiType(XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle objectTypeHandle, Type objectType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type declaredType)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)\r\n   at WriteArrayOfanyTypeToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , CollectionDataContract )\r\n   at System.Runtime.Serialization.CollectionDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)\r\n   at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)\r\n   at System.Runtime.Serialization.DataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)\r\n   at System.Runtime.Serialization.DataContractSerializer.InternalWriteObject(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)\r\n   at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)\r\n   at System.Runtime.Serialization.XmlObjectSerializer.WriteObject(XmlDictionaryWriter writer, Object graph)\r\n   at System.Runtime.Serialization.XmlObjectSerializer.WriteObject(Stream stream, Object graph)\r\n   at Csla.Core.MobileList`1.OnGetChildren(SerializationInfo info, MobileFormatter formatter)\r\n   at Csla.Serialization.Mobile.MobileFormatter.SerializeObject(Object obj)\r\n   at Csla.Core.FieldManager.FieldDataManager.Csla.Serialization.Mobile.IMobileObject.GetChildren(SerializationInfo info, MobileFormatter formatter)\r\n   at Csla.Serialization.Mobile.MobileFormatter.SerializeObject(Object obj)\r\n   at Csla.ReadOnlyBase`1.OnGetChildren(SerializationInfo info, MobileFormatter formatter)\r\n   at Csla.Serialization.Mobile.MobileFormatter.SerializeObject(Object obj)\r\n   at Csla.Core.MobileList`1.OnGetChildren(SerializationInfo info, MobileFormatter formatter)\r\n   at Csla.Serialization.Mobile.MobileFormatter.SerializeObject(Object obj)\r\n   at Csla.Core.FieldManager.FieldDataManager.Csla.Serialization.Mobile.IMobileObject.GetChildren(SerializationInfo info, MobileFormatter formatter)\r\n   at Csla.Serialization.Mobile.MobileFormatter.SerializeObject(Object obj)\r\n   at Csla.ReadOnlyBase`1.OnGetChildren(SerializationInfo info, MobileFormatter formatter)\r\n   at Csla.Serialization.Mobile.MobileFormatter.SerializeObject(Object obj)\r\n   at Csla.Core.FieldManager.FieldDataManager.Csla.Serialization.Mobile.IMobileObject.GetChildren(SerializationInfo info, MobileFormatter formatter)\r\n   at Csla.Serialization.Mobile.MobileFormatter.SerializeObject(Object obj)\r\n   at Csla.ReadOnlyBase`1.OnGetChildren(SerializationInfo info, MobileFormatter formatter)\r\n   at Csla.Serialization.Mobile.MobileFormatter.SerializeObject(Object obj)\r\n   at Csla.Core.MobileObservableCollection`1.OnGetChildren(SerializationInfo info, MobileFormatter formatter)\r\n   at Csla.Serialization.Mobile.MobileFormatter.SerializeObject(Object obj)\r\n   at Csla.Core.FieldManager.FieldDataManager.Csla.Serialization.Mobile.IMobileObject.GetChildren(SerializationInfo info, MobileFormatter formatter)\r\n   at Csla.Serialization.Mobile.MobileFormatter.SerializeObject(Object obj)\r\n   at Csla.ReadOnlyBase`1.OnGetChildren(SerializationInfo info, MobileFormatter formatter)\r\n   at Csla.Serialization.Mobile.MobileFormatter.SerializeObject(Object obj)\r\n   at Csla.Core.FieldManager.FieldDataManager.Csla.Serialization.Mobile.IMobileObject.GetChildren(SerializationInfo info, MobileFormatter formatter)\r\n   at Csla.Serialization.Mobile.MobileFormatter.SerializeObject(Object obj)\r\n   at Csla.ReadOnlyBase`1.OnGetChildren(SerializationInfo info, MobileFormatter formatter)\r\n   at Csla.Serialization.Mobile.MobileFormatter.SerializeObject(Object obj)\r\n   at Csla.Core.FieldManager.FieldDataManager.Csla.Serialization.Mobile.IMobileObject.GetChildren(SerializationInfo info, MobileFormatter formatter)\r\n   at Csla.Serialization.Mobile.MobileFormatter.SerializeObject(Object obj)\r\n   at Csla.Core.ManagedObjectBase.OnGetChildren(SerializationInfo info, MobileFormatter formatter)\r\n   at Csla.Serialization.Mobile.MobileFormatter.SerializeObject(Object obj)\r\n   at Csla.Serialization.Mobile.MobileFormatter.SerializeAsDTO(Object graph)\r\n   at Csla.Serialization.Mobile.MobileFormatter.Serialize(Object obj)\r\n   at Csla.Server.Hosts.HttpPortal.<Update>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Csla.Server.Hosts.HttpPortalController.<InvokePortal>d__5.MoveNext()\r\n```\r\n\r\nThe exception seems to suggest DataContractSerializer is involved, but I thought that the HttpPortalController (which I'm using as the remote host) should always use the MobileFormatter.\r\n\r\nSome calls do succeed though, so I don't think its a general problem, but something with the object graph which the command object is returning.  \r\n\r\nFirst, any idea why I'm getting this error?  Second, why is the DCS involved at all?  We do have BinaryFormatter set as the HttpPortalController is hosted in an Asp.Net site which also currently hosts a .Net remoting portal as well."},"comment":{"url":"https://api.github.com/repos/MarimerLLC/cslaforum/issues/comments/282018657","html_url":"https://github.com/MarimerLLC/cslaforum/issues/320#issuecomment-282018657","issue_url":"https://api.github.com/repos/MarimerLLC/cslaforum/issues/320","id":282018657,"user":{"login":"ajj7060","id":1903891,"avatar_url":"https://avatars.githubusercontent.com/u/1903891?v=3","gravatar_id":"","url":"https://api.github.com/users/ajj7060","html_url":"https://github.com/ajj7060","followers_url":"https://api.github.com/users/ajj7060/followers","following_url":"https://api.github.com/users/ajj7060/following{/other_user}","gists_url":"https://api.github.com/users/ajj7060/gists{/gist_id}","starred_url":"https://api.github.com/users/ajj7060/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajj7060/subscriptions","organizations_url":"https://api.github.com/users/ajj7060/orgs","repos_url":"https://api.github.com/users/ajj7060/repos","events_url":"https://api.github.com/users/ajj7060/events{/privacy}","received_events_url":"https://api.github.com/users/ajj7060/received_events","type":"User","site_admin":false},"created_at":"2017-02-23T15:11:51Z","updated_at":"2017-02-23T15:11:51Z","body":"@rockfordlhotka I believe it does; I have a sample app where I've been trying to replicate the issue (unsuccessfully so far) and I added a property which is an Enum, and it seems to work fine."}}
{"actor":{"display_login":"ajj7060"}}