[Mono-dev] WinForm Crash: null reference or invalid value was found [GDI+ status: InvalidParameter]

Eberhard Beilharz eb1 at sil.org
Mon Feb 27 07:00:17 UTC 2017


Your second call stack shows the Finalize() method - this means that 
some of your controls don't get disposed. Make sure all controls you 
create get disposed, either by adding them to the Forms.Controls 
collection (which gets disposed if you call Form.Dispose()) or by 
explicitly calling the control's Dispose() method for controls that 
aren't added to the collection.

Hope this helps,
     Eberhard

Rgclickit <rglassmeyer at clickitinc.com> wrote on 2017-02-25 at 03:12 +0100:
> I am working on a WinForms application that gets shut down/crashes with the
> exception noted below. The exception details are captured from
> CurrentDomain.UnhandledException. I am running Mono 4.6.2 (Stable
> 4.6.2.16/ac9e222) on Ubuntu 16.04 LTS.
>
> This is difficult to reproduce and seems to occur at random (the best kind
> of problem eh?) The stack trace shows no user code is involved. This
> exception always bubbles up with:
>
> System.ArgumentException: A null reference or invalid value was found [GDI+
> status: InvalidParameter]
>    at System.Drawing.GDIPlus.CheckStatus (System.Drawing.Status status)
> [0x0009b] in <1917aa1c39d94b1a91807b8cd9f03350>:0
>    at System.Drawing.Font.GetHeight (System.Single dpi) [0x0000f] in
> <1917aa1c39d94b1a91807b8cd9f03350>:0
>    at System.Drawing.Font.GetHeight () [0x00006] in
> <1917aa1c39d94b1a91807b8cd9f03350>:0
>
> Any ideas on how to troubleshoot this crash?
>
> Full exception Details:
> System.ArgumentException: A null reference or invalid value was found [GDI+
> status: InvalidParameter]
>    at System.Drawing.GDIPlus.CheckStatus (System.Drawing.Status status)
> [0x0009b] in <1917aa1c39d94b1a91807b8cd9f03350>:0
>    at System.Drawing.Font.GetHeight (System.Single dpi) [0x0000f] in
> <1917aa1c39d94b1a91807b8cd9f03350>:0
>    at System.Drawing.Font.GetHeight () [0x00006] in
> <1917aa1c39d94b1a91807b8cd9f03350>:0
>    at System.Drawing.Font.get_Height () [0x00000] in
> <1917aa1c39d94b1a91807b8cd9f03350>:0
>    at (wrapper remoting-invoke-with-check) System.Drawing.Font:get_Height ()
>    at System.Windows.Forms.Label.InternalGetPreferredSize
> (System.Drawing.Size proposed) [0x0001e] in
> <d5b72d15d4f7424c8a1538e3f19ec2e3>:0
>    at System.Windows.Forms.Label.GetPreferredSize (System.Drawing.Size
> proposedSize) [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0
>    at System.Windows.Forms.Control.get_PreferredSize () [0x00000] in
> <d5b72d15d4f7424c8a1538e3f19ec2e3>:0
>    at (wrapper remoting-invoke-with-check)
> System.Windows.Forms.Control:get_PreferredSize ()
>    at System.Windows.Forms.Layout.DefaultLayout.GetPreferredControlSize
> (System.Windows.Forms.Control child) [0x00000] in
> <d5b72d15d4f7424c8a1538e3f19ec2e3>:0
>    at System.Windows.Forms.Layout.DefaultLayout.LayoutDockedChildren
> (System.Windows.Forms.Control parent, System.Windows.Forms.Control[]
> controls) [0x0002b] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0
>    at System.Windows.Forms.Layout.DefaultLayout.Layout (System.Object
> container, System.Windows.Forms.LayoutEventArgs args) [0x00013] in
> <d5b72d15d4f7424c8a1538e3f19ec2e3>:0
>    at System.Windows.Forms.Control.OnLayout
> (System.Windows.Forms.LayoutEventArgs levent) [0x0007c] in
> <d5b72d15d4f7424c8a1538e3f19ec2e3>:0
>    at System.Windows.Forms.ScrollableControl.OnLayout
> (System.Windows.Forms.LayoutEventArgs levent) [0x00013] in
> <d5b72d15d4f7424c8a1538e3f19ec2e3>:0
>    at System.Windows.Forms.ContainerControl.OnLayout
> (System.Windows.Forms.LayoutEventArgs e) [0x00000] in
> <d5b72d15d4f7424c8a1538e3f19ec2e3>:0
>    at System.Windows.Forms.Form.OnLayout
> (System.Windows.Forms.LayoutEventArgs levent) [0x00000] in
> <d5b72d15d4f7424c8a1538e3f19ec2e3>:0
>    at System.Windows.Forms.Control.PerformLayout
> (System.Windows.Forms.Control affectedControl, System.String
> affectedProperty) [0x00066] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0
>    at (wrapper remoting-invoke-with-check)
> System.Windows.Forms.Control:PerformLayout
> (System.Windows.Forms.Control,string)
>    at System.Windows.Forms.Control+ControlCollection.Remove
> (System.Windows.Forms.Control value) [0x0002b] in
> <d5b72d15d4f7424c8a1538e3f19ec2e3>:0
>    at System.Windows.Forms.Form+ControlCollection.Remove
> (System.Windows.Forms.Control value) [0x0000c] in
> <d5b72d15d4f7424c8a1538e3f19ec2e3>:0
>    at System.Windows.Forms.Form.RemoveOwnedForm (System.Windows.Forms.Form
> ownedForm) [0x00000] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0
>    at (wrapper remoting-invoke-with-check)
> System.Windows.Forms.Form:RemoveOwnedForm (System.Windows.Forms.Form)
>    at System.Windows.Forms.Form.set_Owner (System.Windows.Forms.Form value)
> [0x00017] in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0
>    at System.Windows.Forms.Form.Dispose (System.Boolean disposing) [0x00049]
> in <d5b72d15d4f7424c8a1538e3f19ec2e3>:0
>    at System.ComponentModel.Component.Finalize () [0x00000] in
> <5071a6e4a4564e19a2eda0f53e42f9bd>:0
>
>
>
>
> --
> View this message in context: http://mono.1490590.n4.nabble.com/WinForm-Crash-null-reference-or-invalid-value-was-found-GDI-status-InvalidParameter-tp4670116.html
> Sent from the Mono - Dev mailing list archive at Nabble.com.
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.dot.net
> http://lists.dot.net/mailman/listinfo/mono-devel-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/mono-devel-list/attachments/20170227/609d0735/attachment.html>


More information about the Mono-devel-list mailing list