"System.MissingMethodException" when using HttpClient.MaxResponseContentBufferSize - by Muj Beg

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


2
0
Sign in
to vote
ID 743315 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 5/23/2012 10:49:41 AM
Access Restriction Public

Description

Using MaxResponseContentBufferSize property on HttpCLient produces an unhandled exception of type 'System.MissingMethodException' occurred in Microsoft.VisualStudio.HostingProcess.Utilities.dll

Sign in to post a comment.
Posted by Muj Beg on 5/29/2012 at 11:26 AM
I've attached another project (BugTest3.zp) that also reproduces this error. This is a FX 4.0 console app with only two lines:

    var handler = new System.Net.Http.HttpClientHandler();
    Debug.WriteLine(handler.MaxRequestContentBufferSize);        

Thanks,
MB
Posted by dotnetgator on 5/27/2012 at 8:44 PM
Echoing this experience, and sharing similar insight at the post at : http://forums.asp.net/p/1792578/4931104.aspx/1?HttpClient+weirdness+with+javascript. It appears from the context of that post that the issue is related to both .NET 4 and .NET 4.5 being on the same machine. I am running into the issue when incorporating the WindowsAzure.Storage.Proxy NuGet package (itself marginally, but not truly a MSFT product, especially since Wade Wegner is no longer with MSFT) in an Azure-hosted MVC project to be accessed from WP7. The code includes the following line:
var azureClient = new HttpClient { MaxResponseContentBufferSize = StorageServicesContext.Current.Configuration.WindowsAzureStorageMaximumResponseSize }; in StorageProxyHandler.cs, line 120, which compiles in VS2010SP1 without any issues, but fails with the error listed below at runtime.
Posted by Muj Beg on 5/25/2012 at 6:09 AM
Thanks for looking into the issue.

Some interesting observations:

Please note that the project I attached previously compiles successfully in VS11, even though it contains the following code:

    var client = new System.Net.Http.HttpClient()
                {
                    MaxResponseContentBufferSize = 0x400
                };

VS11 IntelliSense also shows MaxResponseContentBufferSize as a property of HttpClient! This code even runs successfully (without generating an excepion) under the 4.5 FX. However, when the exact same code is run under the 4.0FX, it generates System.MissingMethodException.

Thanks.
MB
Posted by David [MSFT] on 5/24/2012 at 11:48 AM
The MaxResponseContentBufferSize property is not located on the HttpClient object. Instead that property is part of the HttpClient handler.

See MSDN:
http://msdn.microsoft.com/en-us/library/system.net.http.httpclienthandler.maxrequestcontentbuffersize(v=vs.110).aspx

Thank you,

System.Net Team
Posted by MS-Moderator10 [Feedback Moderator] on 5/24/2012 at 12:18 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by MS-Moderator01 on 5/23/2012 at 11:42 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)