[Mono-list] Error in System.Drawing.GDIPlus:GdipDrawLineI when
using third party control
Paddy Joy
mono at paddyjoy.com
Wed May 24 02:21:08 EDT 2006
Hi Sebastien,
Thanks for the help! By using the trace option I was able to find the
cause of the problem, but first some info about my system.
I'm running Linux, fedora core 5, mono and libgdi from svn (last night).
The last few lines of the trace suggest that the code is creating a
brush and a pen, then disposing of the brush before drawing the line.
ENTER: (wrapper managed-to-native) System.Drawing.GDIPlus:GdipCreatePen2
(intptr,single,System.Drawing.Unit,intptr&)(0x89eefc8, 1.000000, 0,
[BYREF:0xbf2dc], )
LEAVE: (wrapper managed-to-native) System.Drawing.GDIPlus:GdipCreatePen2
(intptr,single,System.Drawing.Unit,intptr&)result=0
ENTER: System.Drawing.GDIPlus:CheckStatus (System.Drawing.Status)(0, )
LEAVE: System.Drawing.GDIPlus:CheckStatus (System.Drawing.Status)
ENTER: (wrapper managed-to-native)
System.Drawing.GDIPlus:GdipDeleteBrush (intptr)(0x89eefc8, )
LEAVE: (wrapper managed-to-native)
System.Drawing.GDIPlus:GdipDeleteBrush (intptr)result=0
ENTER: (wrapper managed-to-native) System.Drawing.GDIPlus:GdipDrawLineI
(intptr,intptr,int,int,int,int)(0x89f6b60, 0x89f3b70, 1, 44, 100, 44, )
So it looks like the dodgy third party code is causing the problem,
unfortunately this doesn't throw an error on MS .NET so I dont think the
producer will be fixing it anytime soon! Maybe I should log a bug with
MS ;-) I have reproduced the problem in an attached test case.
Paddy
Sebastien Pouliot wrote:
> Hello Paddy,
>
> On Tue, 2006-05-23 at 14:26 +1000, Paddy Joy wrote:
>
>> I have been trying to get a third party grid control to work on Mono
>> recently, its the Janus Grid control. However I have hit an error that I
>> can't really debug because I don't have the source of the control.
>>
>
> Well you can probably debug it because you have Mono source code for
> both System.Drawing.dll and libgdiplus. Of course not having the control
> source code makes it more challenging ;-)
>
>
>> Anybody got any ideas?
>>
>
> There's not enough data to get very useful ideas. In fact your email
> lacks very basic information, like:
> * Mono version being used;
> * Libgdiplus version being used;
> * Operating system ...
>
> As for debugging it yourself, you can use mono build-in trace tool ("man
> mono" and look for --trace) to get an idea where it failed (and get an
> idea what the method parameters are).
>
> You can also modify either System.Drawing (C#) or libgdiplus (C) to log
> the parameters used to make the call (with more details and/or at the
> "right" moment).
>
>
>> Should I give up and look for an open source
>> alternative?
>>
>
> First things first. If you already invested time and money in this you
> should start by asking your vendor. If no one ask for Mono support, then
> no vendor will invest the time to make sure their controls works with
> Mono.
>
>
>> Thanks
>> Paddy
>>
>>
>> Mono System.Windows.Forms Assembly [$auto_build_revision$]
>> Keyboard: United States keyboard layout (phantom key version)
>> Gtk colorscheme read
>>
>> =================================================================
>> 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 (wrapper managed-to-native) System.Drawing.GDIPlus:GdipDrawLineI
>> (intptr,intptr,int,int,int,int) <0x4>
>> in (wrapper managed-to-native) System.Drawing.GDIPlus:GdipDrawLineI
>> (intptr,intptr,int,int,int,int) <0xffffffa5>
>> in System.Drawing.Graphics:DrawLine (System.Drawing.Pen,int,int,int,int)
>> <0x3d>
>> in (wrapper remoting-invoke-with-check) System.Drawing.Graphics:DrawLine
>> (System.Drawing.Pen,int,int,int,int) <0x3668>
>> in Janus.Windows.GridEX.Internal.JNSCC:PaintGridlines
>> (System.Drawing.Graphics,Janus.Windows.GridEX.Internal.JNSCK,System.Drawing.Rectangle,bool)
>> <0x240>
>> in Janus.Windows.GridEX.Internal.JNSBJ:PaintGridlines
>> (System.Drawing.Graphics,Janus.Windows.GridEX.Internal.JNSCK,System.Drawing.Rectangle)
>> <0x81>
>> in Janus.Windows.GridEX.GridEX:b
>> (System.Drawing.Graphics,Janus.Windows.GridEX.Internal.JNSCK,Janus.Windows.GridEX.GridEXFormatStyle,System.Drawing.Rectangle)
>> <0x7c2>
>> in Janus.Windows.GridEX.GridEX:a
>> (System.Drawing.Graphics,Janus.Windows.GridEX.Internal.JNSCK,Janus.Windows.GridEX.GridEXFormatStyle)
>> <0xa5>
>> in Janus.Windows.GridEX.GridEX:f
>> (System.Drawing.Graphics,Janus.Windows.GridEX.Internal.JNSCJ) <0x9c3>
>> in Janus.Windows.GridEX.GridEX:c
>> (System.Drawing.Graphics,Janus.Windows.GridEX.Internal.JNSCJ) <0x4af>
>> in Janus.Windows.GridEX.GridEX:g (System.Drawing.Graphics) <0x267>
>> in Janus.Windows.GridEX.GridEX:e (System.Drawing.Graphics) <0x43>
>> in Janus.Windows.GridEX.GridEX:OnPaint
>> (System.Windows.Forms.PaintEventArgs) <0x137>
>> in System.Windows.Forms.Control:WndProc (System.Windows.Forms.Message&)
>> <0x563>
>> in Janus.Windows.GridEX.ScrollableBase:WndProc
>> (System.Windows.Forms.Message&) <0x52>
>> in ControlNativeWindow:WndProc (System.Windows.Forms.Message&) <0x14>
>> in System.Windows.Forms.NativeWindow:WndProc
>> (intptr,System.Windows.Forms.Msg,intptr,intptr) <0x11e>
>> in System.Windows.Forms.XplatUIX11:DispatchMessage
>> (System.Windows.Forms.MSG&) <0x16>
>> in System.Windows.Forms.XplatUI:DispatchMessage
>> (System.Windows.Forms.MSG&) <0x15>
>> in System.Windows.Forms.Application:RunLoop
>> (bool,System.Windows.Forms.ApplicationContext) <0x614>
>> in System.Windows.Forms.Application:Run (System.Windows.Forms.Form) <0x24>
>> in JanusTest.Form1:Main () <0x1f>
>> in (wrapper runtime-invoke) System.Object:runtime_invoke_void
>> (object,intptr,intptr,intptr) <0x7d085f9>
>>
>> Native stacktrace:
>>
>> mono(mono_handle_native_sigsegv+0xbf) [0x81547ef]
>> mono [0x8122498]
>> [0x9c8440]
>> /usr/local/lib/libgdiplus.so(gdip_pen_setup+0x3f) [0x81674f]
>> /usr/local/lib/libgdiplus.so(GdipDrawLine+0x118) [0x801ba8]
>> /usr/local/lib/libgdiplus.so(GdipDrawLineI+0x40) [0x801c90]
>> [0xbd1364]
>> [0xbd12ce]
>> [0xbd124e]
>> [0xbd4821]
>> [0xbd4592]
>> [0xbc8ae3]
>> [0xbc8316]
>> [0xbd2244]
>> [0xbc7508]
>> [0xbc6b38]
>> [0xbc63f4]
>> [0x223c40]
>> [0x699654]
>> [0x6990a3]
>> [0x699045]
>> [0xe45ec7]
>> [0x222917]
>> [0x2228f6]
>> [0x216c65]
>> [0x216615]
>> [0x3b6708]
>> [0x3b57be]
>> mono(mono_runtime_exec_main+0x62) [0x80bdd92]
>> mono(mono_runtime_run_main+0x152) [0x80beef2]
>> mono(mono_main+0xe46) [0x805d106]
>> mono [0x805bdb2]
>> /lib/libc.so.6(__libc_start_main+0xdc) [0x9fb724]
>> mono [0x805bd01]
>>
>> _______________________________________________
>> Mono-list maillist - Mono-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-list
>>
>
>
-------------- next part --------------
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication2
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.Size = new System.Drawing.Size(300,300);
this.Text = "Form1";
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
protected override void OnPaint(PaintEventArgs pe)
{
Graphics g = pe.Graphics ;
HatchBrush h = new HatchBrush((System.Drawing.Drawing2D.HatchStyle)12, Color.FromArgb(-5134956), Color.FromArgb(-1));
Pen p = new Pen(h, 5);
h.Dispose();
g.DrawLine(p, 10, 10, 100, 100);
}
}
}
More information about the Mono-list
mailing list