I wrote a method to submit an error-report via HTTP POST. I run OSX-Lion and MonoDevelop. The code works when the application is called from MonoDevelop. When I run the .app it throws an exception:
System.TypeInitializationException: An exception was thrown by the type initializer for System.Net.WebRequest ---> System.DllNotFoundException: libc.dylib
at (wrapper managed-to-native) System.Platform:uname (intptr)
at System.Platform.get_IsMacOS () [0x00000] in <filename unknown>:0
at System.Net.WebRequest..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at ch.fangorn.LIF.Access.SubmitCrash.Submit (Int32 projectId) [0x00000] in <filename unknown>:0
At the moment I call the Submit method directly not via a catch. Since it works when a debugger is attached I'm stranded. What I so far tried:
- Build a mono application bundle (Create mac installer)
- Build everything with Platform target x86
- The beta version of Mono and MonoDevelop
The code that IMO causes the crash.
HttpWebRequest hwr = WebRequest.Create(turi) as HttpWebRequest;
string authInfo = user + ":" + password;
authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));
hwr.Headers["Authorization"] = "Basic " + authInfo;
hwr.Method = "POST";
hwr.ContentType = "text/xml";
hwr.ContentLength = encData.Length;
Stream send = hwr.GetRequestStream();
send.Write(encData, 0, encData.Length);
send.Close();
hwr.GetResponse();
MonoDevelop: 2.8.5
Mono: 2.10.8