ichi.co.uk

HttpWebRequest causes System.NotSupportedException’ occurred in System.Windows.dll.

When using HttpWebRequest asynchronously in a Windows Phone 7 app, the console in Visual Studio was outputting:

A first chance exception of type 'System.NotSupportedException' occurred in System.Windows.dll

The fix was basically adding AllowReadStreamBuffering = true to the HttpWebRequest object. For example:

var request = HttpWebRequest.CreateHttp(feed.Url);
request.AllowReadStreamBuffering = true;

This error didn’t cause my app to crash or any other problems other than the “first chance exception”, so it might be a bug. According to Microsoft, the default value for AllowReadStreamBuffering is true, so I’m not sure why this fixes the problem, but it worked for me.

Recent comments

Blog comments powered by Disqus