[Mono-list] Why is an X server necessary to use
System.Drawing.Graphics?
Adrian Wilkins
adrian.wilkins at gmail.com
Mon Apr 24 09:43:26 EDT 2006
Ok, there are some rather obvious answers to this one (like "It's a
reasonable assumption that graphics need a graphics server....") ...
but...
My situation is that I have a small application that eats XML and
spits PNGs. It uses System.Drawing to accomplish this.
I've been asserting to my users that it's not tested on Mono, but that
since it uses no P/Invoke it should work.
Tested this today on my home box over SSH. Home box is Gentoo Linux
which is primarily used as an HTPC server.
This was on Mono 1.1.13.2
My first surprise was that it required an X server to run ; until I
allowed it an instance of the Cygwin X server it would just stop with
"X connection to localhost:10.0 broken (explicit kill or server
shutdown)." (and no stack trace otherwise).
I don't know yet whether the segfault in GdipDrawRectangleI is just
down to the Cygwin X 6.8.2 server (xwin.exe), or for another reason.
If I get the chance I'll test it later on a native X server.
These are .NET 2.0 binaries built on a Win32 system. I recompiled it
on the Linux box (after commenting out some unsupported, unrelated,
uninvoked code) and got the same result.
I suppose my real concern is that if you want to use code to draw
(e.g.) CAPTCHAs or other bitmaps as part of a process, rather than for
the purposes of drawing UI for the user, running an X server to do it
could seem like overkill on a server that would ordinarily not be
running one. Feel free to mock my reasoning.
The unsupported code was the highly useful (2.0) File.IO.ReadAllText
and WriteAllText, BTW.
---- stack trace
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
Stacktrace:
in <0x4> (wrapper managed-to-native)
System.Drawing.GDIPlus:GdipDrawRectangleI
(intptr,intptr,int,int,int,int)
in <0xffffffa5> (wrapper managed-to-native)
System.Drawing.GDIPlus:GdipDrawRectangleI
(intptr,intptr,int,int,int,int)
in <0x3d> System.Drawing.Graphics:DrawRectangle
(System.Drawing.Pen,int,int,int,int)
in <0x5e> System.Drawing.Graphics:DrawRectangle
(System.Drawing.Pen,System.Drawing.Rectangle)
in <0xfe477edb> (wrapper remoting-invoke-with-check)
System.Drawing.Graphics:DrawRectangle
(System.Drawing.Pen,System.Drawing.Rectangle)
in <0xc3> idgit.DrawModelVisitor:DrawSwimLane (int,int)
in <0x70> idgit.DrawModelVisitor:Visit (idgit.Model.InteractionGroup)
in <0x17> idgit.Model.InteractionGroup:Accept
(idgit.IInteractionDiagramModelVisitor)
in <0x66> idgit.Model.InteractionDiagram:Accept
(idgit.IInteractionDiagramModelVisitor)
in <0x144> idgit.Program:Main (string[])
in <0x50af5db9> (wrapper runtime-invoke)
System.Object:runtime_invoke_void_string[]
(object,intptr,intptr,intptr)
Native stacktrace:
mono(mono_handle_native_sigsegv+0xba) [0x814f8aa]
mono [0x813c209]
[0xffffe440]
Aborted
More information about the Mono-list
mailing list