Bug 21467 - IHttpAsyncHandler doesn't call EndProcessRequest
Summary: IHttpAsyncHandler doesn't call EndProcessRequest
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web ()
Version: 3.2.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-07-21 03:45 UTC by damirainullin
Modified: 2015-01-31 12:47 UTC (History)
3 users (show)

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

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 for Bug 21467 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description damirainullin 2014-07-21 03:45:53 UTC
IHttpAsyncHandler doesn't work with Mono (Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4ubuntu1), Ubuntu 14.04). After completing request.BeginGetResponse AsyncCallback doesn't call EndProcessRequest.

    public bool IsReusable { get { return true; } }

    public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData)
        var request = (HttpWebRequest)HttpWebRequest.Create("http://www.bing.com/");
        request.Method = context.Request.HttpMethod;
        request.UserAgent = context.Request.UserAgent;
        request.Accept = string.Join(",", context.Request.AcceptTypes);
        return request.BeginGetResponse(cb, new object[] { context, request });

    public void EndProcessRequest(IAsyncResult result)
       // EndProcessRequest never called
        var context = (HttpContext)((object[])result.AsyncState)[0];
        var request = (HttpWebRequest)((object[])result.AsyncState)[1];
        using (var response = request.EndGetResponse(result))
            context.Response.ContentType = response.ContentType;

Stackoverflow link:
Comment 1 chrishwang 2015-01-31 12:47:51 UTC
I meet the the same error.

besides if the BeginProcessRequest return IAsyncResult with IsCompleted and CompletedSynchronously is true, the EndProcessRequest didn't be call as the same.

	public class Handler1 : IHttpAsyncHandler
		public void ProcessRequest(HttpContext context)
			//context.Response.ContentType = "text/plain";
			//context.Response.Write("Hello World Sync");

		public bool IsReusable
				return false;

		public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData)
			var ar = new ServiceAsyncResult
				AsyncState = context,
				IsCompleted = true,
				CompletedSynchronously = true,
				AsyncWaitHandle = null,
			return ar;

		public void EndProcessRequest(IAsyncResult result)
			var context = result.AsyncState as HttpContext;
			if (context != null)
				context.Response.ContentType = "text/plain";
				context.Response.Write("Hello World Async");