I'm having a lot of trouble getting a winforms application running with Mono version 4.6.2 (from apt) on Debian 9, Kernel 4.9 with Armv7. I have also tried with Mono 5.18 from the Mono install guide, but I had the same error. This project was previously running on Debian 7 with a 3.0 Kernel and it ran fine.
Any time I try to run my application I see the following error:
Unhandled Exception: 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.Bitmap..ctor (System.Int32 width, System.Int32 height, System.Drawing.Imaging.PixelFormat format) [0x00017] in <1917aa1c39d94b1a91807b8cd9f03350>:0 at System.Drawing.Bitmap..ctor (System.Drawing.Image original, System.Int32 width, System.Int32 height) [0x00000] in <1917aa1c39d94b1a91807b8cd9f03350>:0 at System.Drawing.Bitmap..ctor (System.Drawing.Image original, System.Drawing.Size newSize) [0x00010] in <1917aa1c39d94b1a91807b8cd9f03350>:0 at (wrapper remoting-invoke-with-check) System.Drawing.Bitmap:.ctor (System.Drawing.Image,System.Drawing.Size) at System.Windows.Forms.XplatUIX11.DefineCursor (System.Drawing.Bitmap bitmap, System.Drawing.Bitmap mask, System.Drawing.Color cursor_pixel, System.Drawing.Color mask_pixel, System.Int32 xHotSpot, System.Int32 yHotSpot) [0x0004e] in :0 at System.Windows.Forms.XplatUI.DefineCursor (System.Drawing.Bitmap bitmap, System.Drawing.Bitmap mask, System.Drawing.Color cursor_pixel, System.Drawing.Color mask_pixel, System.Int32 xHotSpot, System.Int32 yHotSpot) [0x00000] in :0 at System.Windows.Forms.Cursor.CreateCursor (System.IO.Stream stream) [0x00058] in :0 at System.Windows.Forms.Cursor..ctor (System.Type type, System.String resource) [0x00021] in :0 at System.Windows.Forms.Cursors.get_SizeNWSE () [0x0001a] in :0 at System.Windows.Forms.SizeGrip..ctor (System.Windows.Forms.Control CapturedControl) [0x00006] in :0 at (wrapper remoting-invoke-with-check) System.Windows.Forms.SizeGrip:.ctor (System.Windows.Forms.Control) at System.Windows.Forms.ScrollableControl.CreateScrollbars () [0x000c2] in :0 at System.Windows.Forms.ScrollableControl..ctor () [0x000b0] in :0 at System.Windows.Forms.ContainerControl..ctor () [0x0000e] in :0 at System.Windows.Forms.Form..ctor () [0x00012] in :0 at HelloWorld..ctor () [0x00000] in <6f95f68c33fe4d859a6075a68bb5c47f>:0 at (wrapper remoting-invoke-with-check) HelloWorld:.ctor () at HelloWorld.Main () [0x00000] in <6f95f68c33fe4d859a6075a68bb5c47f>:0 [ERROR] FATAL UNHANDLED EXCEPTION: 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.Bitmap..ctor (System.Int32 width, System.Int32 height, System.Drawing.Imaging.PixelFormat format) [0x00017] in <1917aa1c39d94b1a91807b8cd9f03350>:0 at System.Drawing.Bitmap..ctor (System.Drawing.Image original, System.Int32 width, System.Int32 height) [0x00000] in <1917aa1c39d94b1a91807b8cd9f03350>:0 at System.Drawing.Bitmap..ctor (System.Drawing.Image original, System.Drawing.Size newSize) [0x00010] in <1917aa1c39d94b1a91807b8cd9f03350>:0 at (wrapper remoting-invoke-with-check) System.Drawing.Bitmap:.ctor (System.Drawing.Image,System.Drawing.Size) at System.Windows.Forms.XplatUIX11.DefineCursor (System.Drawing.Bitmap bitmap, System.Drawing.Bitmap mask, System.Drawing.Color cursor_pixel, System.Drawing.Color mask_pixel, System.Int32 xHotSpot, System.Int32 yHotSpot) [0x0004e] in :0 at System.Windows.Forms.XplatUI.DefineCursor (System.Drawing.Bitmap bitmap, System.Drawing.Bitmap mask, System.Drawing.Color cursor_pixel, System.Drawing.Color mask_pixel, System.Int32 xHotSpot, System.Int32 yHotSpot) [0x00000] in :0 at System.Windows.Forms.Cursor.CreateCursor (System.IO.Stream stream) [0x00058] in :0 at System.Windows.Forms.Cursor..ctor (System.Type type, System.String resource) [0x00021] in :0 at System.Windows.Forms.Cursors.get_SizeNWSE () [0x0001a] in :0 at System.Windows.Forms.SizeGrip..ctor (System.Windows.Forms.Control CapturedControl) [0x00006] in :0 at (wrapper remoting-invoke-with-check) System.Windows.Forms.SizeGrip:.ctor (System.Windows.Forms.Control) at System.Windows.Forms.ScrollableControl.CreateScrollbars () [0x000c2] in :0 at System.Windows.Forms.ScrollableControl..ctor () [0x000b0] in :0 at System.Windows.Forms.ContainerControl..ctor () [0x0000e] in :0 at System.Windows.Forms.Form..ctor () [0x00012] in :0 at HelloWorld..ctor () [0x00000] in <6f95f68c33fe4d859a6075a68bb5c47f>:0 at (wrapper remoting-invoke-with-check) HelloWorld:.ctor () at HelloWorld.Main () [0x00000] in <6f95f68c33fe4d859a6075a68bb5c47f>:0
I originally believed this may be a problem with my application, but I have tried running the following blank winform application (from the mono website) and receive the same error.
using System;
using System.Windows.Forms;
public class HelloWorld : Form
{
static public void Main ()
{
Application.Run (new HelloWorld ());
}
public HelloWorld ()
{
Text = "Hello Mono World";
}
}
By looking at the error message and this other post it seems to be an issue with loading the cursor, but I'm a bit lost on how exactly I can fix that problem. The post is pretty old and can't seem to find any relevant video drivers to fix the hardware cursor problem. Perhaps I need to make an adjustment to my X11 configuration?