Hi, I am currently porting some (actually a lot of) code from .NET to Mono for Android.
At one point there seems to be a problem with the WebClient class, in particular when the connected server responds with an error. The following code snippet can easily provoke (and also explains) the problem: System.Net.WebClient aWebClient = new System.Net.WebClient(); aWebClient.DownloadStringCompleted += (sender, args) => { // This logging output appears as expected Android.Util.Log.Info("TADA", "DownloadStringCompleted"); // This also appears as expected. the property Error is non-null due to the error if (args.Error != null) { Android.Util.Log.Error("TADA", "Error"); } // At the following line an exception is thrown just because the Result property was accessed: // System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. // Instead the Result property should be null. if (args.Result != null) { Android.Util.Log.Info("TADA", args.Result); } }; aWebClient.DownloadStringAsync(new Uri(@"https://justtogetanerror.com/doesnotexist")); I am testing/debugging on a LG Optimus 2X and downloaded the latest Mono for Android yesterday. Thanks for your attention Andreas -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Unexpected-Exception-from-System-Net-WebClient-result-tp5142099p5142099.html Sent from the Mono for Android mailing list archive at Nabble.com. _______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid