[Mono-bugs] [Bug 687865] Async methods of HttpWebRequest fail when compiled for the Device

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Aug 13 11:16:14 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=687865

https://bugzilla.novell.com/show_bug.cgi?id=687865#c23


Sebastien Pouliot <sebastien.pouliot at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|Major                       |Critical

--- Comment #23 from Sebastien Pouliot <sebastien.pouliot at gmail.com> 2011-08-13 15:16:11 UTC ---
I have a workaround - that I don't like even a bit but it works...

                using (var response =
state.Request.EndGetResponse(asynchronousResult) as HttpWebResponse)
                {
// as everyone knows a pretty C.WL can fix everything
Console.WriteLine ("state.Callback type {0} is Action<Response> {1}",
state.Callback.GetType (), (state.Callback is Action<Response>));
                    if (state.Callback is Action<IEnumerable<Response>>)
                    {
                        var callback =
(Action<IEnumerable<Response>>)state.Callback;
                       
callback(Serializer.ReadResponse(response.GetResponseStream()));
                    }
                    else if (state.Callback is Action<Response>)
                    {
                        var callback = (Action<Response>)state.Callback;
                        foreach (var item in
Serializer.ReadResponse(response.GetResponseStream()))
                        {
                            callback(item);
                            return;
                        }
                        callback(null);
                    }
else {
// with the C.WL the code won't reach this part - without it it will!
    Console.WriteLine ("no callback called {0}", state.Callback.GetType ());
}
                }

My guess is that the caching of the original fix is buggy/incomplete. Having a
call to GetType just before  the *is* check likely help/set it to the right
value.

Hopefully this workaround will help your application until we fix this issue
properly.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list