Bug 20239 - Mono < 3.4.0 - 3.8.x fails on armhf platforms with Windows Form including textbox
Summary: Mono < 3.4.0 - 3.8.x fails on armhf platforms with Windows Form including tex...
Status: RESOLVED NORESPONSE
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: 3.4.0
Hardware: Other Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-05-31 09:53 UTC by Alex Lennon
Modified: 2014-10-16 05:04 UTC (History)
7 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test case Windows form with textbox (2.20 KB, text/plain)
2014-05-31 09:53 UTC, Alex Lennon
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NORESPONSE

Description Alex Lennon 2014-05-31 09:53:43 UTC
Created attachment 6936 [details]
Test case Windows form with textbox

Overview
========

When running Mono on an armhf platform a test case Windows Form including a TextBox component causes the runtime to exit.

- This occurs with the current 3.4.0 (i.MX6, RaspberryPi) and also an earlier 3.2.8 (RPi Raspbian). 
- 3.4.0 on Windows 8.1/x64 is fine, as is a vfp only build of 3.4.0 on RaspberryPi

I have attached a simple test case which consists of a Windows Form with a button and a text box.

If the text box is removed from the form by commenting out the addition of the control then the text case will run correctly.

    private void InitializeComponent()
    ..
//        this.Controls.Add(this.textBox1);
    ..

Replication 
===========

To compile the text case use

mcs Form1.cs /r:System.Windows.Forms /r:System.Drawing

then,

mono Form1.exe or mono --debug Form1.exe

This will fail every time on armhf platforms, and work on x86/arm vfp only platforms

Test Results
============

(1) BAD - Raspberry Pi running Raspbian (armhf) - Note slightly older build of Mono

pi@raspberrypi ~ $ mono --version
Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4+rpi1)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp+hard
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen

pi@raspberrypi ~ $ mono --debug Form1.exe
* Assertion at mini-codegen.c:807, condition `i == sel' not met

Further trace details here: http://pastebin.com/kaUDE33W

(2) OK - Windows 8.1 / x64

E:\Projects>mono --version

Mono JIT compiler version 3.4.0 (tarball)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           normal
        SIGSEGV:       normal
        Notification:  Thread + polling
        Architecture:  x86
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen

E:\Projects>mono --debug Form1.exe

(Works fine - shows form with textbox and exit button)

(3) BAD - i.MX6 based platform running Yocto Poky Linux armhf

root@imx6qsabresd:~# mono --version

Mono JIT compiler version 3.4.0 (tarball Tue May 27 13:23:55 BST 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp+hard
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen

root@imx6qsabresd:~# mono --debug Form1.exe
* Assertion at mini-codegen.c:807, condition `i == sel' not met

Further trace details here: http://pastebin.com/fUZtNSD9

(4) BAD - Raspberry Pi running Yocto Poky Linux armhf

root@imx6qsabresd:~# mono --version

Mono JIT compiler version 3.4.0 (tarball Tue May 27 13:23:55 BST 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp+hard
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen

root@raspberrypi:~# mono --debug Form1.exe
* Assertion at mini-codegen.c:807, condition `i == sel' not met

Further trace details here: http://pastebin.com/1Y4RcLGJ

(5) OK - Raspberry Pi running Yocto Poky Linux vfp only, no armhf

root@raspberrypi:~# mono --version
Mono JIT compiler version 3.4.0 (tarball Thu May 22 08:45:42 BST 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen

root@raspberrypi:~# mono --debug Form1.exe

(Works fine - shows form with textbox and exit button)
Comment 1 Alex Lennon 2014-06-26 13:26:33 UTC
Can anybody offer any suggestions on what I could try to fix this?
Comment 2 Bernie 2014-07-08 03:16:24 UTC
This bug is also present in the master branch (currently 3.6.1.0)
Comment 3 Bernie 2014-07-08 03:30:36 UTC
This bug is also reported when executing "make -k check" and is reported in the build log as follows:
...
* Assertion at mini-codegen.c:809, condition `i == sel' not met

Stacktrace:

Native stacktrace:

Debug info from gdb:

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

/bin/bash: line 13:  2943 Aborted                 ./mono-wrapper --compile-all --verify-all --security=verifiable $i
/home/linaro/mono/mcs/class/lib/net_2_0/System.Windows.Forms.dll verification failed
...
Comment 4 Marc Coussement 2014-08-01 12:54:36 UTC
Same issue here

Windows Form including a TextBox component

Mono JIT compiler version 3.6.1 (master/2111224 Wed Jul 30 16:44:51 UTC 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp+hard
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen

root@A20:~# mono WinFormTest2.exe
* Assertion at mini-codegen.c:809, condition `i == sel' not met





Stacktrace:

  at <unknown> <0xffffffff>
  at System.Windows.Forms.TextBoxBase.Draw (System.Drawing.Graphics,System.Drawing.Rectangle) <0x000ab>
  at System.Windows.Forms.TextBoxBase.OnPaintInternal (System.Windows.Forms.PaintEventArgs) <0x00063>
  at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message&) <0x0017f>
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message&) <0x00217>
  at System.Windows.Forms.TextBoxBase.WndProc (System.Windows.Forms.Message&) <0x00313>
  at System.Windows.Forms.TextBox.WndProc (System.Windows.Forms.Message&) <0x001d3>
  at System.Windows.Forms.Control/ControlWindowTarget.OnMessage (System.Windows.Forms.Message&) <0x0002b>
  at System.Windows.Forms.Control/ControlNativeWindow.WndProc (System.Windows.Forms.Message&) <0x0003b>
  at System.Windows.Forms.NativeWindow.WndProc (intptr,System.Windows.Forms.Msg,intptr,intptr) <0x0028b>
  at System.Windows.Forms.XplatUIX11.DispatchMessage (System.Windows.Forms.MSG&) <0x00023>
  at System.Windows.Forms.XplatUI.DispatchMessage (System.Windows.Forms.MSG&) <0x0002b>
  at System.Windows.Forms.Application.RunLoop (bool,System.Windows.Forms.ApplicationContext) <0x00ac7>
  at System.Windows.Forms.Application.Run (System.Windows.Forms.ApplicationContext) <0x0005f>
  at System.Windows.Forms.Application.Run (System.Windows.Forms.Form) <0x0002b>
  at WinFormTest2.Program.Main () <0x0003b>
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:


Debug info from gdb:


=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Aborted
Comment 5 Marc Coussement 2014-08-08 06:48:33 UTC
Hi All,

On System.Windows.Forms.TextBoxBase.Draw

* Assertion at mini-codegen.c:809, condition `i == sel' not met

This problem seems to be so basic and still no solution? 

The first post about this problem on Raspberry pi forum is dated December 2013.
http://www.raspberrypi.org/forums/viewtopic.php?t=11634&p=478459

The same issue has also been mention on other armhf platforms.
I am running on Olimex A20 Allwinner armhf platform with Debian. 

December 2013 till now and still no support?!!

Marc,
Comment 6 Marc Coussement 2014-08-22 08:55:07 UTC
To all, just to inform you,

This problem seems to be solved, I just build mono from git on a fresh SD-card and I can confirm textbox, rich box, data grid seems to be working.

More test with a real code example is needed i just made a form in VS2008.

So now we can start coding for armhf + debian + csharp + winform.

Great

From git build yesterday
JIT version 3.8.1 (master/8020aaf) Aug 21 21:33:39 UTC
 

Marc
Comment 7 Alex Lennon 2014-08-22 11:40:23 UTC
I'm out of the office this week but can make some tests and report back next week.

Thanks to whoever took the time to fix this!

Alex
Comment 8 Marc Coussement 2014-08-22 16:06:54 UTC
unfortunately, i found a new bug this time in DataGridView, maybe you can verify on your setup

https://bugzilla.xamarin.com/show_bug.cgi?id=2297
Comment 9 Marc Coussement 2014-08-22 16:10:21 UTC
https://bugzilla.xamarin.com/show_bug.cgi?id=22297
Comment 10 Janith 2014-09-04 01:18:42 UTC
I am trying to run a very Basic winform application, even without TextBox it crashes at runtime. I am running Mono 3.2.8 on ubuntu 14.04 armhf and I am using a beaglebone black. I tried building Mono from source but the error is the same in Mono 3.8.1 armel,vfp+hard.

Is this a bug or am I missing something:

Stacktrace:

Unhandled Exception:
System.ArgumentException: A null reference or invalid value was found [GDI+ status: InvalidParameter]
  at System.Drawing.GDIPlus.CheckStatus (Status status) [0x00000] in <filename unknown>:0 
  at System.Drawing.Bitmap..ctor (Int32 width, Int32 height, PixelFormat format) [0x00000] in <filename unknown>:0 
  at System.Drawing.Bitmap..ctor (System.Drawing.Image original, Int32 width, Int32 height) [0x00000] in <filename unknown>:0 
  at System.Drawing.Bitmap..ctor (System.Drawing.Image original, Size newSize) [0x00000] in <filename unknown>: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, Color cursor_pixel, Color mask_pixel, Int32 xHotSpot, Int32 yHotSpot) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.XplatUI.DefineCursor (System.Drawing.Bitmap bitmap, System.Drawing.Bitmap mask, Color cursor_pixel, Color mask_pixel, Int32 xHotSpot, Int32 yHotSpot) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Cursor.CreateCursor (System.IO.Stream stream) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Cursor..ctor (System.Type type, System.String resource) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Cursors.get_SizeNWSE () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.SizeGrip..ctor (System.Windows.Forms.Control CapturedControl) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.SizeGrip:.ctor (System.Windows.Forms.Control)
  at System.Windows.Forms.ScrollableControl.CreateScrollbars () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.ScrollableControl..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.ContainerControl..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Form..ctor () [0x00000] in <filename unknown>:0 
  at WindowsFormsApplication1.Form1..ctor () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) WindowsFormsApplication1.Form1:.ctor ()
  at WindowsFormsApplication1.Program.Main () [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: A null reference or invalid value was found [GDI+ status: InvalidParameter]
  at System.Drawing.GDIPlus.CheckStatus (Status status) [0x00000] in <filename unknown>:0 
  at System.Drawing.Bitmap..ctor (Int32 width, Int32 height, PixelFormat format) [0x00000] in <filename unknown>:0 
  at System.Drawing.Bitmap..ctor (System.Drawing.Image original, Int32 width, Int32 height) [0x00000] in <filename unknown>:0 
  at System.Drawing.Bitmap..ctor (System.Drawing.Image original, Size newSize) [0x00000] in <filename unknown>: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, Color cursor_pixel, Color mask_pixel, Int32 xHotSpot, Int32 yHotSpot) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.XplatUI.DefineCursor (System.Drawing.Bitmap bitmap, System.Drawing.Bitmap mask, Color cursor_pixel, Color mask_pixel, Int32 xHotSpot, Int32 yHotSpot) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Cursor.CreateCursor (System.IO.Stream stream) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Cursor..ctor (System.Type type, System.String resource) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Cursors.get_SizeNWSE () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.SizeGrip..ctor (System.Windows.Forms.Control CapturedControl) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.SizeGrip:.ctor (System.Windows.Forms.Control)
  at System.Windows.Forms.ScrollableControl.CreateScrollbars () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.ScrollableControl..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.ContainerControl..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Form..ctor () [0x00000] in <filename unknown>:0 
  at WindowsFormsApplication1.Form1..ctor () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) WindowsFormsApplication1.Form1:.ctor ()
  at WindowsFormsApplication1.Program.Main () [0x00000] in <filename unknown>:0

Thanks
Comment 11 Peter Kormos 2014-09-09 06:53:41 UTC
Hi All,

The problem 

"
When running Mono on an armhf platform a test case Windows Form including a
TextBox component causes the runtime to exit.
"
still exists.

Olimex A20 armhf platform with OlinuXino 

Mono JIT compiler version 3.8.0 (mono-3.8.0-branch/356dbc5 Mon Sep  8 10:10:50 U                                                                             TC 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-proj                                                                             ect.com
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp+hard
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen

Is there a solution?

Thanks in advance,
Peter
Comment 12 Alex Lennon 2014-09-09 08:19:52 UTC
"Is there a solution?"

I'd be overjoyed if anybody could find time to just point me to a place to begin looking for a solution...

Alex
Comment 13 Marc Coussement 2014-09-12 12:05:57 UTC
Alex,

The text box (basic, didn't test it fully) is working with build JIT version 3.8.1 (master/8020aaf) Aug 21 21:33:39 UTC.

see my post 2014-08-22 08:55:07 EDT.


Concerning the DataGridView i made a post for a new bug "22297"

I can't wait until all window forms assembly's or without bugs, i guess this will never happen. So i am using GTK sharp now.

Marc,
Comment 14 Alex Lennon 2014-09-12 12:07:57 UTC
Thanks for the update Marc. 

It doesn't seem there's any interest from anybody informed about this to fix the issue does it.
Comment 15 Alex Lennon 2014-09-12 12:41:26 UTC
As this has been reported to be fixed I'm going to close this bug.

Although given the lack of response it seems to have been a waste of my time (and that of others) bothering to create test cases and a detailed description as suggested on the wiki.
Comment 16 Marc Coussement 2014-09-13 07:08:11 UTC
Alex,

The main question, is offering a 100% compatible windows forms solution for Linux ARM part of Xamarin mainstream business? 
I guess the money has to come from the mobile app developers.
Just for your interest Xamarin and Microsoft are partners.
I hope they will see the potential for a Visual studio capable to generate code for Linux systems. A lot of professionals are willing to pay for a well maintained embedded Linux ARM solution running Win Forms applications.
Comment 17 Alex Lennon 2014-09-13 07:44:15 UTC
Marc,

I completely agree. And yes I was aware of the partnership between Microsoft and Xamarin. I found myself wondering if the lack of interest in providing a current Mono binary for Windows is in anyway related with that partnership.

You may remember that there used to be something called MonoTools. This was a Visual Studio plugin with an opensource server stub to run on the target system.

I was using this and found it was just what I needed. Unfortunately at around the time Xamarin Studio was brought to market (I think) MonoTools disappeared which is a real shame.

It is possible to get Xamarin Studio to remote debug on Linux targets in theory. There are some notes online about how to set an environment variable to achieve this but it is clunky. Also, whilst I've had this working for a simple test solution it hasn't worked for me for a production solution I imported to Xamarin Studio from Visual Studio. I haven't yet had time to work out whether it is a configuration problem or something deeper.

What I really want is what MonoTools provided - a simple seamless Visual Studio plugin that enables me to debug with Mono on remote (in my case ARM) targets.

I spoke to Xamarin about this some time ago but didn't get the feeling there was any interest.

I did start investigating what it would take to provide an open source VS plugin for Mono debugging and the initial work is here -

It's not in any way complete due to my lack of time. The next step was to work out how to map source lines to target code to add breakpoint support and so forth

https://github.com/DynamicDevices/monodebugvs

"A lot of professionals are willing to pay for a well
maintained embedded Linux ARM solution running Win Forms applications."

I'd be very interested in doing this if there was a business case. We work predominantly with Embedded Linux ARM targets and I am developing and deploying commercial .NET applications on top of Mono on those targets.

I maintain the meta-mono layer which provides Mono support for Yocto Embedded Linux and would dearly like to have a more complete solution - for use at Dynamic Devices if nothing else - to build and deploy such systems.

It sounds like our interests are aligned. Keep in touch and maybe we can find a way forward.

Cheers, Alex
Comment 18 Marc Coussement 2014-09-13 08:32:02 UTC
Alex,

Just FYI, the remote soft debugger is still available in the Linux Monodevelop studio.
For setup see http://stackoverflow.com/questions/10864548/debugging-mono-applications-directly-on-arm-target

At first glance it works, didn’t test it on a longer track.

VS solution see FREE plugin “Debugging Mono Applications with Visual Studio 2013” http://www.giesswein-apps.at/mono . Seems to be very new, didn't test it till now.
Your contribution for mono on Yocto seems very interesting. Yocto is also on my road map but there is lack on time.

Marc,
Comment 19 Alex Lennon 2014-09-13 08:36:34 UTC
Marc,

Yes indeed. For anybody who comes across this thread via Google the mechanism you link to also works for Xamarin Studio 

http://tirania.org/blog//archive/2013/Oct.html

Thanks for the heads up on the Mono Debugger plugin! It looks just what I need. It might provide the impetus for me to move up to 2013.

Thanks again,

Alex
Comment 20 Harry May 2014-10-10 16:17:24 UTC
the same bug still exists on all ARM platform,
I tested it on beaglebone, raspberry pi, banana pi, under ubuntu.

Creating a TextBox results in:

  at System.Windows.Forms.TextBoxBase.Draw (System.Drawing.Graphics,System.Drawing.Rectangle) <0x000ab>
  at System.Windows.Forms.TextBoxBase.OnPaintInternal (System.Windows.Forms.PaintEventArgs) <0x00063>

no problem on x86 platforms, it just crashes on ARM.

why is the status: RESOLVED NORESPONSE

Its not resolved.

Harry
Comment 21 Alex Lennon 2014-10-11 04:49:11 UTC
"As this has been reported to be fixed I'm going to close this bug."

Are you saying that this is not resolved with 3.8.1 Harry?

Thanks,

Alex
Comment 22 Harry May 2014-10-16 04:58:07 UTC
no, sorry, all is OK.
I had a version prior 3.8
Tested it with 3.10 and all works perfectly.

Harry
Comment 23 Alex Lennon 2014-10-16 05:04:36 UTC
Great news. Thanks for letting us know Harry. I shall close again