[Mono-dev] strange problem with mkbundle

michelw michel.waast at gmail.com
Tue Apr 24 10:46:46 UTC 2012


Hello,

i've a strange problem.

I do a simple program for test (download a http file, and print to 
console the file), who works fine on framework 2, 3, 3.5, 4.0. (on dev 
machine)

First problem:
When i use mkbundle -o mytest mytest.exe --deps --static, i see he 
always use /usr/lib/mono/4.0/mscorlib.dll and 
/usr/lib/mono/gac/***/4.0.0.0****, even i compile on 2,3,3.5, or 4.0....

Second: (very strange)
When i launch my test program on another linux machine, who haven't 
mono, if i compile it with 4.0, i've the error :
  System.NotSupportedException: http://www.domain.com/page.php
   at System.Net.WebRequest.GetCreator (System.String prefix) [0x00000] 
in <filename unknown>:0
   at System.Net.WebRequest.Create (System.Uri requestUri) [0x00000] in 
<filename unknown>:0
   at System.Net.WebRequest.Create (System.String requestUriString) 
[0x00000] in <filename unknown>:0
   at mytest.MainClass.Main (System.String[] args) [0x00000] in 
<filename unknown>:0

But, if i compile on 2,3 or 3.5, i've no error, test program works fine 
(remember he use /***/4.0 dll with mkbundle)

Have you an idea?

Here my simple code, he you want to try

using System;
using System.IO;
using System.Net;
using System.Web;
using System.Net.Security;
using System.Text;
using System.Text.RegularExpressions;

namespace mytest
{
     class MainClass
     {
         public static void Main (string[] args)
         {
             try
             {
                 HttpWebRequest request = 
(HttpWebRequest)WebRequest.Create("http://www.mydomain.com/page.php");
                 HttpWebResponse reponse = 
(HttpWebResponse)request.GetResponse();

                 Stream response = reponse.GetResponseStream();

                 byte[] buf = new byte[8192];
                 int count=0;
                 do
                 {
                     count = response.Read(buf,0,buf.Length);
                     
Console.WriteLine(Encoding.ASCII.GetString(buf,0,count));
                 } while (count > 0);
             }
             catch (Exception ex)
             {
                 Console.WriteLine("Erreur " + ex.ToString());
             }
         }
     }
}



More information about the Mono-devel-list mailing list