Bug 18944 - WebConnectionStream.cs:714 - Cannot cast from source type to destination type.
Summary: WebConnectionStream.cs:714 - Cannot cast from source type to destination type.
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 7.2.1
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Martin Baulig
URL:
: 19850 ()
Depends on:
Blocks:
 
Reported: 2014-04-11 05:32 UTC by asp_net
Modified: 2014-08-13 13:54 UTC (History)
14 users (show)

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


Attachments
Error in line 714. (290.07 KB, image/png)
2014-04-11 05:32 UTC, asp_net
Details


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 asp_net 2014-04-11 05:32:05 UTC
Created attachment 6554 [details]
Error in line 714.

See the screenshot attached. Unfortunately the value of result.InnerAsyncResult isn't available within the debugger at that time.

I face that error randomly when doing multipart uploads.

Xamarin.iOS
Version: 7.2.1.31 (Business Edition)
Hash: dcc652e
Branch: 
Build date: 2014-04-02 17:22:19-0400
Comment 1 Rolf Bjarne Kvinge [MSFT] 2014-04-11 06:47:50 UTC
Do you have a test project we can use to reproduce this?
Comment 2 asp_net 2014-04-11 09:32:20 UTC
Unfortunately not, it's not really reproducable but occurs randomly. The regarding project is too large and complex to provide.

Thomas
Comment 3 BB 2014-05-04 14:58:50 UTC
I have also started getting this error since the upgrade to Xamarin.iOS 7.2.1 that I did last week, and have not had any problems before that so I really think it is to do with the upgrade.

It's crashing on line 721 for me:

System.InvalidCastException: Cannot cast from source type to destination type.
  at System.Net.WebConnectionStream.WriteRequestAsyncCB (IAsyncResult ar) [0x00007] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/WebConnectionStream.cs:721
  at System.Net.WebAsyncResult.CB (System.Object unused) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/WebAsyncResult.cs:151

I can't reproduce it unfortunately, but it's happened 3 time in 3 days, so far.
Comment 4 Rolf Bjarne Kvinge [MSFT] 2014-05-05 04:17:22 UTC
Martin, this looks like your area.
Comment 5 Martin Baulig 2014-05-08 09:47:55 UTC
Some more info in that other bug.
Comment 6 Rolf Bjarne Kvinge [MSFT] 2014-05-16 05:23:56 UTC
Martin, which other bug?
Comment 7 Sebastien Pouliot 2014-05-16 08:34:37 UTC
Martin, can you identify which mono commit solved this issue ?

Something similar has been reported on the forums [1] but this was closed without any details, so I'm not sure if that was released in 7.2.1 (the milestone) or only in master.

[1] https://forums.xamarin.com/discussion/16782/strange-errors-since-updating-to-xamarin-ios-7-2#latest
Comment 8 Rolf Bjarne Kvinge [MSFT] 2014-05-19 04:20:58 UTC
*** Bug 19850 has been marked as a duplicate of this bug. ***
Comment 9 BB 2014-05-22 11:05:54 UTC
Hi Rolf, can you give an indication of which release and when this fix is likely to be available?
Comment 10 Zeno Foltin 2014-06-06 09:16:31 UTC
I'm getting the same exception as BB using the latest Xamarin.Android. Nearly every other webrequest crashes the app. Was able to downgrade the build machine to Xamarin.Android 4.12.3 which doesn't seem to have this issue.
Comment 11 Dmitry Skorinko 2014-06-08 11:03:52 UTC
See this error on both platforms after upgrading to Xamarin.iOS 7.2.3.39 and Xamarin.Android 4.12.4
The same bug: https://bugzilla.xamarin.com/show_bug.cgi?id=20165
Comment 12 Alex Groenevelt 2014-06-09 18:06:12 UTC
I'm also seeing the same error as Dmitry and others have described using the latest stable builds.  The error is intermittent but seems to occur most often during application startup and resume for me.  Obviously this is a showstopper for app store submission.  Can we get some confirmation on what build this fix has/will be released with or what build we should roll back to (and how)?  Much thanks.
Comment 13 Rolf Bjarne Kvinge [MSFT] 2014-06-10 07:02:55 UTC
@Alex, Xamarin.iOS 7.2.0 does not have this problem, it was introduced with Xamarin.iOS 7.2.1. You can download earlier versions from your Xamarin Store account (https://store.xamarin.com/account/my/subscription/downloads)
Comment 16 BB 2014-08-02 10:59:24 UTC
Can someone please confirm which version this is now fixed in? I am still stuck using 7.2.0 until this has been fixed in a stable version...
Comment 17 Sebastien Pouliot 2014-08-04 08:31:20 UTC
I'm not 100% sure as this bug does not have a commit revision or a release information. @Martin could confirm this.

XI 7.2.4 [1] was an hotfix release that contained several HTTP stack fixes - and the dates match.

[1] http://developer.xamarin.com/releases/ios/xamarin.ios_7/xamarin.ios_7.2/#4
Comment 18 Martin Baulig 2014-08-04 08:46:53 UTC
Not entirely sure about the exact commit number, but Mono 3.6 and anything more recent has it.
Comment 19 BB 2014-08-13 13:54:44 UTC
Seriously, as this is an intermittent bug, I really do need 100% confirmation if this is fixed in a stable version.

The latest version Xamarin Studio is offering me is:

Mono Framework 3.6.0.39
Xamarin Studio 5.2.11
Xamarin.iOS 7.2.6.28

The release notes for Mono 3.6 don't mention this bug number (#18944): 

http://www.mono-project.com/Release_Notes_Mono_3.6

so please confirm if I upgrade that this bug is fixed.