[MonoTouch] Is System.Net.WebClient supported?

Romulo Mendivil wammy21 at gmail.com
Thu Aug 6 17:03:01 EDT 2009


Per Jonathan Pryor's sample:

using(var reader = new StreamReader(
	new WebClient().OpenRead(new Uri("http://www.mono-project.com/ 
Main_Page"))))
{
	Console.Write(reader.ReadToEnd());	
}

Gives:

Unhandled Exception: System.Net.WebException: An error occurred  
performing a WebClient request. --->  
System.TypeInitializationException: An exception was thrown by the  
type initializer for System.Net.WebRequest --->  
System.MissingMethodException: Method not found: 'Default constructor  
not found...ctor() of System.Net.HttpRequestCreator'.
   at System.Activator.CreateInstance (System.Type type, Boolean  
nonPublic) [0x00000]
   at System.Net.WebRequest.AddPrefix (System.String prefix,  
System.Type type) [0x00000]
   at System.Net.WebRequest..cctor () [0x00000]
   --- End of inner exception stack trace ---
   at System.Net.WebClient.SetupRequest (System.Uri uri) [0x00000]
   at System.Net.WebClient.OpenRead (System.Uri address) [0x00000]

I have not been able to add -nolink to mtouch command per my previous  
message.

Thanks,

On Aug 6, 2009, at 1:49 PM, Geoff Norton wrote:

> We have figured out the problems with this, and it will be fixed in  
> the next release.  For now you can do
>
> wc.OpenRead (new Uri ("http....."));
>
> as a workaround
>
> -g
>
> On 6-Aug-09, at 3:10 PM, Mike Bluestein wrote:
>
>> Here's a snippet of code
>>
>> 			WebClient wc = new WebClient ();
>> 			string result;
>> 			
>> 			using(StreamReader rdr = new StreamReader (wc.OpenRead("http://www.mono-project.com/Main_Page 
>> ")))
>> 			{
>> 			    result = rdr.ReadToEnd ();
>> 			}
>>
>> that results in this error
>>
>> Unhandled Exception: System.MethodAccessException: Method  
>> `System.Text.StringBuilder:AppendFormat (string,object,object)' is  
>> inaccessible from method `System.Net.WebClient:GetQueryString (bool)'
>>
>>   at System.Net.WebClient.MakeUri (System.String path) [0x00000]
>>   at System.Net.WebClient.CreateUri (System.String address) [0x00000]
>>   at System.Net.WebClient.OpenRead (System.String address) [0x00000]
>>   at (wrapper remoting-invoke-with-check)  
>> System.Net.WebClient:OpenRead (string) ..
>> _______________________________________________
>> MonoTouch mailing list
>> MonoTouch at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/monotouch
>
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/mailman/private/monotouch/attachments/20090806/bc0ab07f/attachment.html 


More information about the MonoTouch mailing list