KeithBoynton | 15 Mar 2012 18:47
Picon

GDI+ status: InvalidParameter from LinearGradientBrush

I'm receiving this error when trying to run an application on OS-X under Mono
which is being ported from Windows.

Obviously the application runs fine in Windows. I've pulled across the .sln
and all class files etc. from the Visual Studio 2010 project into my
MonoDevelop environment in OS-X Lion.

The solution compiles fine with no errors. However when I try to run it I
get this error.

A null reference or invalid value was found [GDI+ status: InvalidParameter]
at System.Drawing.GDIPlus.CheckStatus (Status status) [0x0009d]
in
/private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs:220 
  at System.Drawing.Drawing2D.LinearGradientBrush..ctor (Rectangle rect,
Color color1, Color color2, LinearGradientMode linearGradientMode)
[0x00025]
in
/private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientBrush.cs:66 
  at (wrapper remoting-invoke-with-check)
System.Drawing.Drawing2D.LinearGradientBrush:.ctor
(System.Drawing.Rectangle,System.Drawing.Color,System.Drawing.Color,System.Drawing.Drawing2D.LinearGradientMode)
  at
System.Windows.Forms.ToolStripProfessionalRenderer.OnRenderToolStripPanelBackground
(System.Windows.Forms.ToolStripPanelRenderEventArgs e) [0x00000]
in
/private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripProfessionalRenderer.cs:425 
  at System.Windows.Forms.ToolStripRenderer.DrawToolStripPanelBackground
(System.Windows.Forms.ToolStripPanelRenderEventArgs e) [0x00000]
in
(Continue reading)

Stifu | 15 Mar 2012 20:11
Picon
Favicon
Gravatar

Re: GDI+ status: InvalidParameter from LinearGradientBrush

Sadly, GDI+ and WinForms are simply buggy, especially on Mac.
If you've got an X11 server installed, you could try running your
application this way:

MONO_MWF_MAC_FORCE_X11=1 mono yourapp.exe

This will give better results.

KeithBoynton wrote
> 
> I'm receiving this error when trying to run an application on OS-X under
> Mono which is being ported from Windows.
> 
> Obviously the application runs fine in Windows. I've pulled across the
> .sln and all class files etc. from the Visual Studio 2010 project into my
> MonoDevelop environment in OS-X Lion.
> 
> The solution compiles fine with no errors. However when I try to run it I
> get this error.
> 
> A null reference or invalid value was found [GDI+ status:
> InvalidParameter]
> at System.Drawing.GDIPlus.CheckStatus (Status status) [0x0009d] in
>
/private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs:220 
>   at System.Drawing.Drawing2D.LinearGradientBrush..ctor (Rectangle rect,
> Color color1, Color color2, LinearGradientMode linearGradientMode)
> [0x00025] in
>
/private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientBrush.cs:66 
(Continue reading)

KeithBoynton | 16 Mar 2012 11:10
Picon

Re: GDI+ status: InvalidParameter from LinearGradientBrush

That's disappointing, the offending control looks to be the toolstrip so I
guess I'll try and switch it for another control and see if I have more joy
with that.

The only thing that worries me with using X11 is distribution of the app,
there's be a dependency on X11 then.

I suppose my safest alternative is to split out the UI layer and implement
it some other way maybe using GTK#?

--
View this message in context: http://mono.1490590.n4.nabble.com/GDI-status-InvalidParameter-from-LinearGradientBrush-tp4475791p4477768.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.
_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list

Coda Highland | 16 Mar 2012 17:58
Picon

Re: GDI+ status: InvalidParameter from LinearGradientBrush

I believe you can circumvent the dependency. I've not tried it with
Mono, but there are WINE packaging tools out there that include an X
server in the private resources that runs independently of the
installed X11.app, so that Cmd+Tab works as expected to switch between
applications. Check out how Wineskin does it; maybe that would be a
useful approach.

/s/ Adam

On Fri, Mar 16, 2012 at 5:10 AM, KeithBoynton
<keithboynton <at> flaredesign.co.uk> wrote:
> That's disappointing, the offending control looks to be the toolstrip so I
> guess I'll try and switch it for another control and see if I have more joy
> with that.
>
> The only thing that worries me with using X11 is distribution of the app,
> there's be a dependency on X11 then.
>
> I suppose my safest alternative is to split out the UI layer and implement
> it some other way maybe using GTK#?
>
> --
> View this message in context: http://mono.1490590.n4.nabble.com/GDI-status-InvalidParameter-from-LinearGradientBrush-tp4475791p4477768.html
> Sent from the Mono - WinForms mailing list archive at Nabble.com.
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list
_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list
(Continue reading)

Stifu | 16 Mar 2012 19:02
Picon
Favicon
Gravatar

Re: GDI+ status: InvalidParameter from LinearGradientBrush

GTK# or MonoMac.
Or help and fix WinForms. :p

There was also a project to reimplement WinForms on Mac using MonoMac, but I
don't know if it's still active.

KeithBoynton wrote
> 
> That's disappointing, the offending control looks to be the toolstrip so I
> guess I'll try and switch it for another control and see if I have more
> joy with that.
> 
> The only thing that worries me with using X11 is distribution of the app,
> there's be a dependency on X11 then.
> 
> I suppose my safest alternative is to split out the UI layer and implement
> it some other way maybe using GTK#?
> 

--
View this message in context: http://mono.1490590.n4.nabble.com/GDI-status-InvalidParameter-from-LinearGradientBrush-tp4475791p4478926.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.
_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list

KeithBoynton | 17 Mar 2012 19:46
Picon

Re: GDI+ status: InvalidParameter from LinearGradientBrush

Interesting the offending control was the ToolStripContainer. I've removed
that and it works just fine.

Looks like the ToolStripContainer implementation is buggy. If I knew enough
about the WinForms implementation on Mono I'd certainly try to help :p

Thanks for the feedback guys!

--
View this message in context: http://mono.1490590.n4.nabble.com/GDI-status-InvalidParameter-from-LinearGradientBrush-tp4475791p4481056.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.
_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


Gmane