[Mono-winforms-list] System.Windows.Forms.XplatUI ---> > System.Net.Sockets.SocketException

Ben Lamb mono-winforms@zurgy.org
Tue, 3 May 2005 22:32:22 +0100

Hi Peter,

Hmm, I don't think it's Mono problem. By default DISPLAY is set to :0.0

If I set it to localhost:0.0 or localhost:0 I don't get the error but I don't 
see any windows or dialogs appear. The program appears to run as if I put 
some WriteLine statements before the MessageBox these are output to the 
console. Finally it times out with:

Unhandled Exception: System.TypeInitializationException: An exception was 
thrown by the type initializer for System.Windows.Forms.XplatUI ---> 
System.ArgumentNullException: Could not open display (X-Server required. 
Check you DISPLAY environment variable)
Parameter name: Display
in <0x005fb> System.Windows.Forms.XplatUIX11:SetDisplay (IntPtr 
in <0x00098> System.Windows.Forms.XplatUIX11:.ctor ()

[rest of stacktrace skipped]

After changing DISPLAY if I try to run xhost + it pauses for ages before 

xhost:  unable to open display "localhost:0.0"

It would appear that X is configured slightly oddly under Kubuntu, I imagine, 
as you suggest, the permissions are broken somewhere. The loopback interface 
seems to be misconfigured, for example, I couldn't ping localhost or Assigning an IP of to lo made ping work but didn't help 

Oh, the reason for the same error under 1.1.6 was because I'd upgraded 
System.Windows.Forms to one of the nightly builds available on the Mono 
website in my mono 1.1.6 installation before compiling everything SVN.

Thanks for your ideas. Please do you have any further suggestions on what bits 
of the X config might be broken?



> Are you sure you got the *same* error with 1.1.6? Or maybe just also an
> error, but a different one. The one you post might be related to the new IO
> layer, but I don't think that was available in 1.1.6 yet. If it is indeed
> the same, it might be related to what your DISPLAY variable is set to.
> The error you are getting is WSAEADDRNOTAVAIL: This error occurs when an
> application attempts to connect to a remote host, and the address is not
> available from the local system
> Are you sure that you can talk/have the rights to/etc whatever transport
> you are trying to use (dependent on your display var).
> Sorry to be so vague, but I don't have much to go on.
> Cheers,
>   Peter