Discord.net not working on linux - c#

I'm trying to get a discord bot coded in discord.net running on a linux VPS, I'm running via mono but I keep getting this error
Unhandled Exception:
System.Exception: Connection lost
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
at Discord.TaskManager.ThrowException () <0x419160b0 + 0x00065> in <filename unknown>:0
at Discord.Net.WebSockets.WebSocket.WaitForConnection (CancellationToken cancelToken) <0x4192a2a0 + 0x000af> in <filename unknown>:0
at Discord.Net.WebSockets.GatewaySocket.WaitForConnection (CancellationToken cancelToken) <0x4192a1b0 + 0x000c3> in <filename unknown>:0
at Discord.DiscordClient+<BeginConnect>d__78.MoveNext () <0x41836df0 + 0x01406> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
at Discord.DiscordClient+<BeginConnect>d__78.MoveNext () <0x41836df0 + 0x01abe> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f0ad7fff6b0 + 0x000a7> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f0ad7fff630 + 0x0006b> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f0ad7fff5e0 + 0x0003a> in <filename unknown>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () <0x7f0ad7fffb10 + 0x00012> in <filename unknown>:0
at Discord.DiscordClient+<Connect>d__77.MoveNext () <0x41836560 + 0x002b1> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f0ad7fff6b0 + 0x000a7> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f0ad7fff630 + 0x0006b> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f0ad7fff5e0 + 0x0003a> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x7f0ad7fff5c0 + 0x00012> in <filename unknown>:0
at MiXBot.Program+<>c+<<Main>b__1_3>d.MoveNext () <0x41835e40 + 0x001bd> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f0ad7fff6b0 + 0x000a7> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f0ad7fff630 + 0x0006b> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f0ad7fff5e0 + 0x0003a> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x7f0ad7fff5c0 + 0x00012> in <filename unknown>:0
at Discord.DiscordClient.ExecuteAndWait (System.Func`1 asyncAction) <0x41835b00 + 0x00086> in <filename unknown>:0
at MiXBot.Program.Main (System.String[] args) <0x417fbf60 + 0x002a3> in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.Exception: Connection lost
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
at Discord.TaskManager.ThrowException () <0x419160b0 + 0x00065> in <filename unknown>:0
at Discord.Net.WebSockets.WebSocket.WaitForConnection (CancellationToken cancelToken) <0x4192a2a0 + 0x000af> in <filename unknown>:0
at Discord.Net.WebSockets.GatewaySocket.WaitForConnection (CancellationToken cancelToken) <0x4192a1b0 + 0x000c3> in <filename unknown>:0
at Discord.DiscordClient+<BeginConnect>d__78.MoveNext () <0x41836df0 + 0x01406> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
at Discord.DiscordClient+<BeginConnect>d__78.MoveNext () <0x41836df0 + 0x01abe> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f0ad7fff6b0 + 0x000a7> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f0ad7fff630 + 0x0006b> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f0ad7fff5e0 + 0x0003a> in <filename unknown>:0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () <0x7f0ad7fffb10 + 0x00012> in <filename unknown>:0
at Discord.DiscordClient+<Connect>d__77.MoveNext () <0x41836560 + 0x002b1> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f0ad7fff6b0 + 0x000a7> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f0ad7fff630 + 0x0006b> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f0ad7fff5e0 + 0x0003a> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x7f0ad7fff5c0 + 0x00012> in <filename unknown>:0
at MiXBot.Program+<>c+<<Main>b__1_3>d.MoveNext () <0x41835e40 + 0x001bd> in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x7f0ad80016d0 + 0x00029> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x7f0ad7fff6b0 + 0x000a7> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x7f0ad7fff630 + 0x0006b> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x7f0ad7fff5e0 + 0x0003a> in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x7f0ad7fff5c0 + 0x00012> in <filename unknown>:0
at Discord.DiscordClient.ExecuteAndWait (System.Func`1 asyncAction) <0x41835b00 + 0x00086> in <filename unknown>:0
at MiXBot.Program.Main (System.String[] args) <0x417fbf60 + 0x002a3> in <filename unknown>:0
I have mono and .net core installed and I'm running it through mono.
Any suggestions? (I'd like to stick with discord.net if possible)

I'm just going to take a stab at the solution because I didn't see you mention that you installed dotnet core on linux. Here is a guide that has a checklist to follow your steps to make sure it's working correctly. Discord.net appears to be in .net core.
If it still fails after that, try running other .net core apps on your linux server and see if those work. I hope this helps!
https://learn.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x

I'm going to assume due to lack of context that you built your application using .Net Framework to which I can recommend you switch to .Net Core.
Afterwhich as mentioned by Solarcloud ensure you have Dotnet Core installed on your Linux box and then you can simply run it by dotnet MyApplication.dll after you build it, navigate to the folder etc.

as per the docs it doesn't support mono
Using this library with Mono is not supported until further notice. It is known to have issues with the library's WebSockets implementation and may crash the application upon startup.
https://docs.stillu.cc/guides/getting_started/installing.html?tabs=vs-install%2Ccore2-1
It runs perfectly fine on linux if you target .net core since d.net targets .net standard

As shown in the docs (https://docs.stillu.cc/guides/getting_started/installing.html), it's not possible to run Discord.Net with Mono.
I suggest you to switch to .NET Core. When you'll now compile the code, it will output a .dll file (and regular .exe if 3.1+)
Download .NET Core runtime on your distribution: https://learn.microsoft.com/en-us/dotnet/core/install/linux
Once it's installed you should be able to run the .dll file with the following command in the terminal:
dotnet <path_to_dll>

Related

Xamarin async Http Client

I've got a problem in my Xamarin Project: When I try to get a JsonString from a Webpage, via HttpClient.GetStringAsncy does my app crash. Here is the StackTrace of the error:
at System.Net.Http.HttpClientHandler+d__63.MoveNext () [0x00479] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in :0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in :0
at System.Net.Http.HttpClient+d__49.MoveNext () [0x000ca] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in :0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in :0
at System.Net.Http.HttpClient+d__54.MoveNext () [0x0007d] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in :0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in :0
at MRKrauchthal.Pages.GameDetailPage+d__13.MoveNext () [0x00057] in E:\Visual Studio Projects\MRKrauchthal\MRKrauchthal\MRKrauchthal\Pages\GameDetailPage.xaml.cs:99
e.InnerException
{System.Net.WebException: Error: SecureChannelFailure (The authentication or decryption has failed.) ---> System.IO.IOException: The authentication or decryption has failed. ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: The authentication or decryption has failed.
at Mono.Security.Protocol.Tls.RecordProtocol.EndReceiveRecord (System.IAsyncResult asyncResult) [0x00037] in :0
at Mono.Security.Protocol.Tls.SslClientStream.SafeEndReceiveRecord (System.IAsyncResult ar, System.Boolean ignoreEmpty) [0x00000] in :0
at Mono.Security.Protocol.Tls.SslClientStream.NegotiateAsyncWorker (System.IAsyncResult result) [0x00071] in :0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslClientStream.EndNegotiateHandshake (System.IAsyncResult result) [0x00032] in :0
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (System.IAsyncResult asyncResult) [0x0000c] in :0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslStreamBase.EndRead (System.IAsyncResult asyncResult) [0x0004b] in :0
at Mono.Net.Security.Private.LegacySslStream.EndAuthenticateAsClient (System.IAsyncResult asyncResult) [0x0000e] in :0
at Mono.Net.Security.Private.LegacySslStream.AuthenticateAsClient (System.String targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, System.Boolean checkCertificateRevocation) [0x0000e] in :0
at Mono.Net.Security.MonoTlsStream.CreateStream (System.Byte[] buffer) [0x0007b] in :0
at System.Net.WebConnection.CreateStream (System.Net.HttpWebRequest request) [0x00073] in :0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00058] in :0
at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func`2[T,TResult] endFunction, System.Action`1[T] endAction, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in :0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in :0
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in :0
at System.Net.Http.HttpClientHandler+d__63.MoveNext () [0x0041e] in :0 }
The Code looks like this:
private async Task SetImage(int id, string teamName, Xamarin.Forms.Image image)
{
try
{
HttpClient httpClient = new HttpClient();
obj = JsonConvert.DeserializeObject<JsonImage>(await httpClient.GetStringAsync("www.linkToImage.com").ConfigureAwait(false));
}
catch (Exception e) {
test.Text = e.StackTrace;
}
}
I hope someone can help me :D
Best Regards
There is some problem with the default SSL/TLS implementation in Xamarin.Android. You can go to Android Project settings->Android Options->Advanced->SSL/TLS implementation and change to Native TLS 1.2+

ADAL: Error with getting token on specific machine

I have a C# app written for pushing some data to MS service (PowerBI) using ADAL for authentication. I have created and compiled it using Mono on Debian Jessie (trying to get as close to production environment as possible). It runs perfectly on this machine but when I move it to production I get an error Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException: user_realm_discovery_failed: User realm discovery failed. I have read it might be connected to defaultProxy setting in machine.config so I modified my code accordingly but it didn't help. Main differences between production server and my machine are:
Command line only (prod) -> GNOME, Static IP -> Dynamic IP. Both are virtual machines. The full error output:
Unhandled Exception:
Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException: user_realm_discovery_failed: User realm discovery failed ---> System.Net.WebException: Error getting response stream (Write: failed.): SendFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server. Error code
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.RemoteValidation (Mono.Security.Protocol.Tls.ClientContext context, AlertDescription description) [0x00000] in <filename unk
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()
at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.HttpWebRequestWrapper+<GetResponseSyncOrAsync>d__2.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.IdentityModel.Clients.ActiveDirectory.IHttpWebResponse].GetResult () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.UserRealmDiscoveryResponse+<CreateByDiscoveryAsync>d__0.MoveNext () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Microsoft.IdentityModel.Clients.ActiveDirectory.UserRealmDiscoveryResponse+<CreateByDiscoveryAsync>d__0.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.IdentityModel.Clients.ActiveDirectory.UserRealmDiscoveryResponse].GetResult () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.AcquireTokenNonInteractiveHandler+<PreTokenRequest>d__4.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.AcquireTokenHandlerBase+<RunAsync>d__0.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult].GetResult () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext+<AcquireTokenCommonAsync>d__0.MoveNext () [0x00000] in <filename unknown>:0
ErrorCode: user_realm_discovery_failed
StatusCode: 0
[ERROR] FATAL UNHANDLED EXCEPTION: Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException: user_realm_discovery_failed: User realm discovery failed ---> System.Net.WebException: Erhe authentication or decryption has failed.): SendFailure ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: Invalid certifica0xffffffff800b010a
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.RemoteValidation (Mono.Security.Protocol.Tls.ClientContext context, AlertDescription description) [0x00000] in <filename unk
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()
at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.HttpWebRequestWrapper+<GetResponseSyncOrAsync>d__2.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.IdentityModel.Clients.ActiveDirectory.IHttpWebResponse].GetResult () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.UserRealmDiscoveryResponse+<CreateByDiscoveryAsync>d__0.MoveNext () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Microsoft.IdentityModel.Clients.ActiveDirectory.UserRealmDiscoveryResponse+<CreateByDiscoveryAsync>d__0.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.IdentityModel.Clients.ActiveDirectory.UserRealmDiscoveryResponse].GetResult () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.AcquireTokenNonInteractiveHandler+<PreTokenRequest>d__4.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.AcquireTokenHandlerBase+<RunAsync>d__0.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult].GetResult () [0x00000] in <filename unknown>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext+<AcquireTokenCommonAsync>d__0.MoveNext () [0x00000] in <filename unknown>:0
ErrorCode: user_realm_discovery_failed
StatusCode: 0
All the references to <filename unknown>:0 are not helpful either.
EDIT: I have also tried compiling it on the production machine - same error when trying to run
I have figured it out myself, quite stupid mistake. I installed mono from default debian repos and they were outdated. I have actually thought about it and added xamarin up-to-date repos, but I didn't notice that on apt-get upgrade the mono packages got kept back. apt-get distro-upgrade fixed it all. Just have to be careful with this command - can mess up your system.

monodevelop crashes with WebRequest

This problem has kind of stumpped me for the last couple of hours. Any clue why the application is crashing with this callstack in monodevelop. It will compile and run correctly if I build the application with xbuild.
Unhandled Exception:
System.Net.WebException: An exception occurred during a WebClient request. ---> System.TypeInitializationException: The type initializer for 'System.Net.WebRequest' threw an exception. ---> System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system. ---> System.TypeLoadException: Failure has occurred while loading a type.
at System.Configuration.Configuration.Init (IConfigSystem system, System.String configPath, System.Configuration.Configuration parent) [0x00065] in /builddir/build/BUILD/mono-4.2.3/mcs/class/System.Configuration/System.Configuration/Configuration.cs:137
at System.Configuration.Configuration..ctor (System.Configuration.InternalConfigurationSystem system, System.String locationSubPath) [0x0005c] in /builddir/build/BUILD/mono-4.2.3/mcs/class/System.Configuration/System.Configuration/Configuration.cs:96
at System.Configuration.Configuration..ctor (System.Configuration.InternalConfigurationSystem system, System.String locationSubPath) [0x0003b] in /builddir/build/BUILD/mono-4.2.3/mcs/class/System.Configuration/System.Configuration/Configuration.cs:91
at System.Configuration.InternalConfigurationFactory.Create (System.Type typeConfigHost, System.Object[] hostInitConfigurationParams) [0x0000e] in /builddir/build/BUILD/mono-4.2.3/mcs/class/System.Configuration/System.Configuration/InternalConfigurationFactory.cs:41
at System.Configuration.ConfigurationManager.OpenExeConfigurationInternal (ConfigurationUserLevel userLevel, System.Reflection.Assembly calling_assembly, System.String exePath) [0x00102] in /builddir/build/BUILD/mono-4.2.3/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs:119
at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x00011] in /builddir/build/BUILD/mono-4.2.3/mcs/class/System.Configuration/System.Configuration/ClientConfigurationSystem.cs:49
--- End of inner exception stack trace ---
at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x00025] in /builddir/build/BUILD/mono-4.2.3/mcs/class/System.Configuration/System.Configuration/ClientConfigurationSystem.cs:52
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in /builddir/build/BUILD/mono-4.2.3/mcs/class/System.Configuration/System.Configuration/ClientConfigurationSystem.cs:61
at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in /builddir/build/BUILD/mono-4.2.3/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs:159
at System.Net.WebRequest..cctor () [0x00014] in /builddir/build/BUILD/mono-4.2.3/mcs/class/System/System.Net/WebRequest.cs:71
--- End of inner exception stack trace ---
at System.Net.WebClient.GetWebRequest (System.Uri address) [0x00000] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/System/net/System/Net/webclient.cs:285
at ParkitectNexus.Data.Web.Client.NexusWebClient.GetWebRequest (System.Uri uri) [0x00003] in /home/michaelpollind/Desktop/ParkitectNexusClient/src/ParkitectNexus.Data/Web/Client/NexusWebClient.cs:70
at System.Net.WebClient.OpenReadAsync (System.Uri address, System.Object userToken) [0x0003b] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/System/net/System/Net/webclient.cs:1846
--- End of inner exception stack trace ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:201
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:372
at ParkitectNexus.Data.Web.API.ParkitectNexusAPI+<GetRequiredModIdentifiers>c__async1.MoveNext () [0x000b8] in /home/michaelpollind/Desktop/ParkitectNexusClient/src/ParkitectNexus.Data/Web/API/ParkitectNexusAPI.cs:86
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:201
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:372
at ParkitectNexus.Client.Base.Pages.AssetsPageView+<GetRequiredMods>c__async0.MoveNext () [0x0007c] in /home/michaelpollind/Desktop/ParkitectNexusClient/src/ParkitectNexus.Client.Base/Pages/AssetsPageView.cs:62
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__1 (System.Object state) [0x00000] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1010
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x0000e] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/mscorlib/system/threading/threadpool.cs:1291
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, Boolean preserveSyncCtx) [0x00081] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/mscorlib/system/threading/executioncontext.cs:581
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, Boolean preserveSyncCtx) [0x00000] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/mscorlib/system/threading/executioncontext.cs:530
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x0002a] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/mscorlib/system/threading/threadpool.cs:1268
at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00096] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/mscorlib/system/threading/threadpool.cs:859
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in /builddir/build/BUILD/mono-4.2.3/external/referencesource/mscorlib/system/threading/threadpool.cs:1196
After some testing I found that creating a separate project and copying everything into it seems to have resolved the configuration error. If anyone has any insight into this, I would like to know.

Mono.Security.Protocol.Tls.TlsException: buffer underrun

I have a very strange problem.
We implemented a Soap API to talk to a third party. The API sort of works. There is an IsAlive method which checks if the third party service is alive.
Our application is hosted on an Ubuntu 14.04 server under Apache with Mod-Mono (Mono).
We call this API when we load a particular page. It works up to a point then we get an error. I.E. You can make a request to the IsAlive xxx (It's random) amount of times and it works, then next time you try and do it the following exception gets thrown:
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Net.WebException: Error writing headers ---> System.IO.IOException: Error while sending TLS Alert (Fatal:InternalError): System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: buffer underrun
at Mono.Security.Protocol.Tls.RecordProtocol.ReadRecordBuffer (Int32 contentType, System.IO.Stream record) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslClientStream.EndNegotiateHandshake (IAsyncResult result) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0 ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: buffer underrun
at Mono.Security.Protocol.Tls.RecordProtocol.ReadRecordBuffer (Int32 contentType, System.IO.Stream record) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslClientStream.EndNegotiateHandshake (IAsyncResult result) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.WebConnection.EndWrite (System.Net.HttpWebRequest request, Boolean throwOnError, IAsyncResult result) [0x00000] in <filename unknown>:0
at System.Net.WebConnectionStream+<SetHeadersAsync>c__AnonStorey1.<>m__0 (IAsyncResult r) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse (System.Net.WebRequest request) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Web.UI.Page.ProcessException (System.Exception e) [0x00000] in <filename unknown>:0
at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
at ASP.somepage_aspx.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
at System.Web.HttpApplication+<Pipeline>c__Iterator1.MoveNext () [0x00000] in <filename unknown>:0
at System.Web.HttpApplication.Tick () [0x00000] in <filename unknown>:0
Mono.Security.Protocol.Tls.TlsException: buffer underrun
at Mono.Security.Protocol.Tls.RecordProtocol.ReadRecordBuffer (Int32 contentType, System.IO.Stream record) [0x00000] in <filename unknown>:0
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
The API at this point does not work anymore. Even if we refresh the page and make another call. We try to re-request 2-3 times then we get another error.
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Net.WebException: The request timed out
at System.Net.HttpWebRequest.GetRequestStream () [0x00000] in <filename unknown>:0
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Web.UI.Page.ProcessException (System.Exception e) [0x00000] in <filename unknown>:0
at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
at ASP.somepage_aspx.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
at System.Web.HttpApplication+<Pipeline>c__Iterator1.MoveNext () [0x00000] in <filename unknown>:0
at System.Web.HttpApplication.Tick () [0x00000] in <filename unknown>:0
System.Net.WebException: The request timed out
at System.Net.HttpWebRequest.GetRequestStream () [0x00000] in <filename unknown>:0
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x00000] in <filename unknown>:0
The only way to make the API work again is if we restart the Ubuntu Server.
Here is a snippet of how we send the request.
public string TestSiteStatus()
{
getSiteStatus site = new getSiteStatus();
site.site = "XXX";
string res = "";
using (SiteServiceImplService service = new SiteServiceImplService())
{
res = service.getSiteStatus(site);
}
return res;
}
Does anyone know what is wrong here? Is there a problem with my implementation or is this a Mono framework issue?
I have tried the instructions on this page: http://www.mono-project.com/docs/faq/security/ but no success. When I run thetest, it passes the first and sometimes the second time but fails after that.
Turns out there was a certificate issue with our third party. They updated their certificates, we added them to our stores, and it worked.
Our the API SSL cert was vulnerable to a LogJam attack. The ciphering of the certificate caused problems with our server.
This link helped us test and find the problem.

HelloWorld is successfully launched by Windows .NET but not by MONO

I've installed mono on my 64-bit Windows 7 using:
mono-3.2.3-gtksharp-2.12.11-win32-0.exe
from go-mono download page
in directory (without spaces in path) changed according to Jim Gomes' advice
Successfully run first two examples
Console Hello World
Gtk# Hello World
from Mono Basics article.
But the 3d example "WinForms Hello World" is compiled without errors and run from Windows (by double-clicking in Windows Explorer) successfully but running:
mono hello.exe
from "Mono-3.2.3 Command Prompt" window produces the errors listed below
(note that first two examples including a window of second example was launched successfully from command prompt invoking through mono ...)
What is the problem and how to overcome it?
UPDATE
According to mentioned article "Mono Basics" I compiled the 3d example "Winforms Hello World" with gmcs hello.cs -pkg:dotnet.
BTW, where is that dotnet package located?
Is it in directory with the same name? I do not have a single dir with exactly such name dotnet under Mono-3.2.3 dir
The errors produced by running mono hello.exe from "Mono-3.2.3 Command Prompt"
Unhandled Exception:
System.TypeInitializationException:
An exception was thrown by the type initializer for
System.Windows.Forms.WindowsFormsSynchronizationContext
---> System.TypeInitializationException:
An exception was thrown by the type initializer for
System.Windows.Forms.ThemeEngine ---> System.TypeInitializationException:
An exception was thrown by the type initializer for
System.Windows.Forms.ThemeWin32Classic
---> System.TypeInitializationException:
An exception was thrown by the type initializer for System.Drawing.KnownColors
---> System.TypeInitializationException:
An exception was thrown by the type initializer for System.Drawing.GDIPlus
---> System.DllNotFoundException: /tmp/install/lib/libgdiplus.so at
(wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup
(ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
at System.Drawing.GDIPlus..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Drawing.KnownColors..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Drawing.Color.get_Black () [0x00000] in <filename unknown>:0
at System.Windows.Forms.ThemeWin32Classic..cctor () [0x00000] in <filename unk
nown>:0
--- End of inner exception stack trace ---
at System.Windows.Forms.ThemeEngine..cctor () [0x00000] in <filename unknown>:
0
--- End of inner exception stack trace ---
at System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined () [0x0
0000] in <filename unknown>:0
at System.Windows.Forms.Control..ctor () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:.ctor ()
at System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () [0x00000]
in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Windows.Forms.Control..ctor () [0x00000] in <filename unknown>:0
at System.Windows.Forms.ScrollableControl..ctor () [0x00000] in <filename unkn own>:0
at System.Windows.Forms.ContainerControl..ctor () [0x00000] in <filename unkno wn>:0
at System.Windows.Forms.Form..ctor () [0x00000] in <filename unknown>:0
at HelloWorld..ctor () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) HelloWorld:.ctor ()
at HelloWorld.Main () [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException:
An exception was thrown by the type initializer for
System.Windows.Forms.WindowsFormsSynchronizationContext
---> System.TypeInitializationException:
An exception was thrown by the type initializer for
System.Windows.Forms.ThemeEngine
---> System.TypeInitializationException:
An exception was thrown by the type initializer for
System.Windows.Forms.ThemeWin32Classic
---> System.TypeInitializationException:
An exception was thrown by the type initializer for
System.Drawing.KnownColors
---> System.TypeInitializationException:
An exception was thrown by the type initializer for
System.Drawing.GDIPlus
---> System.DllNotFoundException: /tmp/install/lib/libgdiplus.so
at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
at System.Drawing.GDIPlus..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Drawing.KnownColors..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Drawing.Color.get_Black () [0x00000] in <filename unknown>:0
at System.Windows.Forms.ThemeWin32Classic..cctor () [0x00000] in <filename unk
nown>:0
--- End of inner exception stack trace ---
at System.Windows.Forms.ThemeEngine..cctor () [0x00000] in <filename unknown>:
0
--- End of inner exception stack trace ---
at System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined () [0x0
0000] in <filename unknown>:0
at System.Windows.Forms.Control..ctor () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:.ctor ()
at System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () [0x00000]
in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Windows.Forms.Control..ctor () [0x00000] in <filename unknown>:0
at System.Windows.Forms.ScrollableControl..ctor () [0x00000] in <filename unkn
own>:0
at System.Windows.Forms.ContainerControl..ctor () [0x00000] in <filename unkno
wn>:0
at System.Windows.Forms.Form..ctor () [0x00000] in <filename unknown>:0
at HelloWorld..ctor () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) HelloWorld:.ctor ()
at HelloWorld.Main () [0x00000] in <filename unknown>:0
I have encountered this problem.
I think this is mono's bug.
If you installed mono in C:\Program Files (x86)\Mono-3.2.3\etc\mono
Find the file C:\Program Files (x86)\Mono-3.2.3\etc\mono\config
Change Line 29-30:
<dllmap dll="gdiplus" target="/tmp/install/lib/libgdiplus.so" />
<dllmap dll="gdiplus.dll" target="/tmp/install/lib/libgdiplus.so" />
To:
<dllmap dll="gdiplus" target="/tmp/install/lib/libgdiplus.so" os="!windows" />
<dllmap dll="gdiplus.dll" target="/tmp/install/lib/libgdiplus.so" os="!windows" />
And this problem will be solved.

Categories

Resources