[Mono-bugs] [Bug 666173] New: Writing to an asynchronous HttpWebRequest request stream causes a fatal exception when the request is cancelled
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Fri Jan 21 10:12:33 EST 2011
https://bugzilla.novell.com/show_bug.cgi?id=666173
https://bugzilla.novell.com/show_bug.cgi?id=666173#c0
Summary: Writing to an asynchronous HttpWebRequest request
stream causes a fatal exception when the request is
cancelled
Classification: Mono
Product: MonoTouch
Version: unspecified
Platform: Other
URL: http://stackoverflow.com/questions/4592150/monotouch-w
ebrequest-connection-fails-after-switching-off-airplan
e-mode-on-iphon
OS/Version: Apple iOS 4.2
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Class Libraries
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: novell at fcmobile.nl
QAContact: mono-bugs at lists.ximian.com
CC: novell at fcmobile.nl
Found By: Third Party Developer/Partner
Blocker: No
When I cancel an asynchronous HttpWebRequest request and the application tries
to write to the request stream, a NullReference exception is thrown.
Even if I catch this exception, the application crashes.
iOS version 4.2.1 (8C148)
Monotouch version: 3.2.4
Code fragment (full code listing see
http://stackoverflow.com/questions/4592150/monotouch-webrequest-connection-fails-after-switching-off-airplane-mode-on-iphon):
using (var stream = _request.EndGetRequestStream(asyncResult))
{
using (var textStream = new StreamWriter(stream))
{
Database.Instance.CreateSyncData().Save(textStream);
}
}
_request.BeginGetResponse(new AsyncCallback(ProcessResponse),
null);
If the user cancels the request, _request.Abort() is called on the main thread.
1. If this happens before the call to _request.EndGetRequestStream, a
WebException is thrown when calling _request.EndGetRequestStream (correct).
2. If this happens after the call to Save(textStream), a WebException is thrown
when calling _request.BeginGetResponse (correct).
3. If this happens after the call to _request.EndGetRequestStream but BEFORE
the call to Save(textStream), a NullReference exception is thrown when calling
Save(textStream),
and even if you catch that exception the application crashes.
Native stacktrace:
0 MyApp 0x006765c4
mono_handle_native_sigsegv + 404
1 MyApp 0x0065fc9c
mono_sigsegv_signal_handler + 348
2 libSystem.B.dylib 0x33bd3ddf _sigtramp + 42
3 MyApp 0x00686418 add_var + 232
4 MyApp 0x00686418 add_var + 232
5 MyApp 0x0068c79c frame_commands + 1492
6 MyApp 0x0068ded0 debugger_thread + 1232
7 MyApp 0x0078bc2c thread_start_routine +
240
8 MyApp 0x007bac38 GC_start_routine + 132
9 libSystem.B.dylib 0x33bd688d _pthread_start + 248
10 libSystem.B.dylib 0x33bcba90 thread_assign_default +
4294967295
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list