Hi, It turned out the method lookup in ServiceKnownTypeAttribute was implemented way different from what .NET exactly expects (which is not documented). I did a couple of experiment and fixed our code in git. https://github.com/mono/mono/commit/77758013
Atsushi Eno (2011/04/13 10:10), thenextman wrote: > Hi > > I have an application that uses WCF. It runs great on Mono 2.8.2 on Ubuntu > and .NET 3.0 on Windows. > > It decorates the WCF service contract with the 'ServiceKnownType' attribute, > which points to a method returning the derived types needed to use the > server: > > [ServiceKnownType("GetKnownTypes", typeof(KnownTypeProvider)] > > I am porting my app to MonoTouch. I am using the latest 4.0, based on Mono > 2.10.1. This no longer works: my WCF call fails because the > DataContractSerializer on the client doesn't recognise the return type. > > I set a breakpoint in my 'GetKnownTypes' method and see that it is never > called. I assume that this part of System.ServiceModel is not present / not > working in MonoTouch? > > I try to work around this by decorating the base return type with the > 'KnownType' attribute instead. > > [KnownType("GetKnownTypes")] > > Again, it doesn't work and my 'GetKnownTypes' method is never called. > Looking at the source for DataContractSerializer, it seems if you use a > method name rather than specifying the type, it just gets ignored?! > > I will try again by specifying the type instead of using a method (looking > at the source of DataContractSerializer, it *looks* like this will work), > however this is tricky for me in MonoTouch because I will need to use typeof > rather than Type.GetType("fully.qualified.typename"). > > Is there another solution? Workaround? > > I did see this: > http://stackoverflow.com/questions/771560/how-do-you-configure-wcf-known-types-programmatically/2104482#2104482, > however it seems MonoTouch is missing some of the required interfaces... > > Thanks in advance > > -- > View this message in context: > http://mono.1490590.n4.nabble.com/WCF-KnownTypes-in-Mono-2-10-MonoTouch-4-0-tp3446014p3446014.html > Sent from the Mono - General mailing list archive at Nabble.com. > _______________________________________________ > Mono-list maillist - Mono-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-list > > > _______________________________________________ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list