Cannot re-call start of asynchronous method while a previous call is still in progress.

When running multiple HttpClient postAsync() inside a Task.WhenAll() the following error is thrown on Android (Player/Native Nexus 5.1):

InvalidOperationException: Cannot re-call start of asynchronous method while a previous call is still in progress.

After some research I found:

Marek Safar 2015-01-05 11:48:55 EST
You need Xamarin.Android 5.0 which is the first version with the fix
Source

My currently installed Version: 4.20.1.0 (Trial Edition)

So when I check for updates stable/beta/alpha there is no "Xamarin.Android 5.0" available yet..

Where can I find this "Xamarin.Android 5.0" update? I need this working badly as im loosing time and money here.

Furthermore the problem resides in the HttpClientHandler() which has been fixed? according to this

When targeting IOS it works flawlessly!

Operating System: Mac OS X 10.10.2

Posts

  • MihaMarkicMihaMarkic SI ✭✭✭✭
    edited March 2015

    Are you using a single HttpClient instance? Try with an instance per simultaneous request.

  • fghgfhfghgfh USMember
    edited March 2015

    Thanks for your reply, but what you mention there is a silly and quite inefficient work around.

    I initiate one instance which will get authentication cookies once and then this "authenticated instance" is used in a sequence of long running and nested tasks. So if I were to implement your suggestion then every nested task must initiate a new client and get authentication cookies again which will be quite inefficient don't you agree?

    The logic has been developed on Windows for years using Visual Studio and has done billions of iterations without failure, which im now trying to port to Xamarin Forms. The first testings on the IOS emulator looks promising though, which unfortunately isn't the case for Xamarin.Android (yet).

  • MihaMarkicMihaMarkic SI ✭✭✭✭

    Yeah, well, sorry for not being able to read your mind. Well, keep waiting and loosing money, what can I say. Perhaps the 5.0 is on alpha channel.

  • fghgfhfghgfh USMember

    I checked the alpha channel already but it's not there yet..

    Anyway thanks for you input.

  • fghgfhfghgfh USMember

    There is a preview release for Xamarin.Android 5.0 hidden @ the android wear section.

    Xamarin.Android
    Version: 5.0.0.17 (Trial Edition)

    Did some quick testings, and it seems that concurrent postAsync() is working now.

  • BradleyLockeBradleyLocke AUMember

    Its hidden pretty well! Can someone show me whereabouts in the Android Wear section the download link for Xamarin.Android 5.0 is?

  • MihaMarkicMihaMarkic SI ✭✭✭✭

    This developer.xamarin.com/releases/android/xamarin.android_5/xamarin.android_5.1/
    However, the fix will supposedly appear only in beta, not in alpha.

  • fghgfhfghgfh USMember

    Xamarin.Android
    Version: 5.1.0.100 (Trial Edition)

    Xamarin Studio > check for updates > switch to alpha channel > just install the Xamarin Android update

    Fix is also included.

Sign In or Register to comment.