I’m using a WCF service created with Visual Studio.
I’m doing a call such as GetDataAsync(param) for retrieve data. In the GetDataCompleted handler, I’m using the retrieved data.
The service works. Sometimes I can’t retrieve data. In this case, an exception occurred like the following:
Exception in async operation: System.Net.ProtocolViolationException: The number of bytes to be written is greater than the specified ContentLength.
at System.Net.WebConnectionStream.CheckWriteOverflow (Int64 contentLength, Int64 totalWritten, Int64 size) [0x00038] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/WebConnectionStream.cs:546
How is it possible to catch a similar excpetion? The application still working but the exception is printed at console. I think the exception cames from Channel or something else.
Thank you in advance.
Unfortunately these WCF exceptions can’t be caught in Monotouch at present. This seems to be a known bug. See MonoTouch – WCF Services made by Silverlight tool – Can't catch exceptions