Bug 1164 - TargetInvocationException / SerializationException on response from a web service (which works on MonoTouch)
Summary: TargetInvocationException / SerializationException on response from a web ser...
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 1.0
Hardware: Macintosh Mac OS
: High major
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2011-09-30 12:39 UTC by Chris Hardy [MSFT]
Modified: 2012-01-20 00:26 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Chris Hardy [MSFT] 2011-09-30 12:39:24 UTC
Created attachment 544 [details]
Mono for Android which produces the issue

Getting this error when running a HTTPS webservice from Mono for Android, same code works when running from MonoTouch.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.Serialization.SerializationException: Deserializing type 'System.Void'. Expecting state 'EndElement'. Encountered state 'Text' with name '' with namespace ''. (1,121)

Full stacktrace here: https://gist.github.com/ff63a01916c935700ca8

Attached it the Mono for Android project with the issue. I will attach the MonoTouch project which works after submitting this bug.
Comment 1 Chris Hardy [MSFT] 2011-09-30 12:40:41 UTC
Created attachment 545 [details]
MonoTouch project that works correctly.
Comment 2 David 2011-12-05 12:11:07 UTC
We are having the same problem and have determined that the WCF service we are calling will work in mono for android 1.0.3 but will not work in 1.2 (or for that matter 1.9.2 beta)
Comment 3 David 2011-12-06 15:40:50 UTC
UPDATE:  We also tried this with Mono for Android 4.0 and have the same error.  for the time being we are having to use Mono for android 1.0.3 for our app because this is preventing us from talking to the WCF server.  We also get this error when we use HTTP instead of HTTPS.
Comment 4 David 2011-12-15 13:24:18 UTC
Can anyone tell me when this issue might be resolved?
Comment 5 Miguel de Icaza [MSFT] 2012-01-09 15:45:50 UTC
Jonathan, can you look at this bug?
Comment 6 Jonathan Pryor 2012-01-17 17:55:58 UTC
It should be noted that MonoTouch has apparently regresssed here: running Attachment 545 [details] under MonoTouch 5.1.2.1.1326819896 shows the same exception as Mono for Android produces.

The immediate cause appears to be that System.ServiceModel.Description.ContractDescriptorGenerator.GetMessage() changes the type of the JSMGetDatabasesResult message from `typeof(string)` to `typeof(void)`, which breaks everything else.

I still need to figure out the appropriate fix.
Comment 7 Jonathan Pryor 2012-01-20 00:26:25 UTC
Fixed in master/00e29089 and mono-2-10/51e38b50.