Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.
This repository was archived by the owner on Nov 1, 2020. It is now read-only.

[Windows Forms] Controls support #7995

Open

Description

@kant2002

Here the summary of controls working in Windows Forms in my limited testing

Common Controls

  • Button
  • CheckBox
  • CheckedListBox Crash on click when empty or on startup if any items
  • ComboBox Crash on dropdown open
  • DateTimePicker Crash on select date
  • Label
  • LinkLabel Crash on hover
  • ListBox Crash on select item
  • ListView
  • MaskedTextBox
  • MonthCalendar Crash on startup
  • NotifyIcon Crash on startup when icon set
  • NumericUpDown
  • PictureBox Crash on startup
  • ProgressBar
  • RadioButton
  • RichTextBox Crash on startup
  • TextBox
  • ToolTip
  • TreeView
  • WebBrowser Crash on startup

Containers

  • FlowLayoutPanel
  • GroupBox
  • Panel
  • SplitContainer Crash on hover
  • TabControl
  • TableLayoutPanel

Menu & Toolstrip

  • ContextMenuStrip Crash on show
  • MenuStrip Crash on startup
  • StatusStrip Crash on startup when use ToolstripDropDown and ToolStripSplitButton
  • ToolStrip
  • ToolStripContainer

I can understand that some issues i due to lack of COM support, but some "crash on selection" looks more like CoreRT issue. Anyway, this issue to give visibility for list of supported out-of-box controls.

Activity

  1. MichalStrehovsky commented on Feb 18, 2020

    @MichalStrehovsky
    Member

    Great list, thank you for documenting this!

  2. teobugslayer commented on Mar 21, 2020

    @teobugslayer
    Contributor

    I experimented a bit with the MenuStrip. Unfortunately, I am not a .NET dev, so I hit an impenetrable wall.

    On startup, I get a very weird exception (Maybe there's a separate issue with exception generation of CoreRT):

    Unhandled exception at 0x00007FF7F1EF5634 in winforms.exe: 0x892BE4EA. occurred

    And the following call stack:

    FailFast�() Unknown
    S_P_CoreLib_System_Runtime_CalliIntrinsics__Call_5�() Unknown
    S_P_CoreLib_System_Runtime_CalliIntrinsics__CallVoid_3�() Unknown
    S_P_CoreLib_System_Runtime_EH__UnhandledExceptionFailFastViaClasslib�() Unknown
    S_P_CoreLib_System_Runtime_EH__DispatchEx�() Unknown
    RhThrowEx�() Unknown
    RhpThrowEx() Line 191 Unknown
    S_P_Interop_Internal_Runtime_CompilerHelpers_RuntimeInteropData__GetStructUnsafeStructSize�() Unknown
    S_P_CoreLib_System_Runtime_InteropServices_Marshal__SizeOfHelper�() Unknown
    S_P_CoreLib_System_Runtime_InteropServices_Marshal__SizeOf_1�() Unknown
    System_Drawing_Common_System_Drawing_Icon__BmpFrame�() Unknown
    System_Drawing_Common_System_Drawing_Icon__ToBitmap�() Unknown
    System_Windows_Forms_Primitives_System_Windows_Forms_DpiHelper__GetBitmapFromIcon�() Unknown
    System_Windows_Forms_System_Windows_Forms_ToolStripScrollButton__get_UpImage�() Unknown
    System_Windows_Forms_System_Windows_Forms_ToolStripScrollButton__CreateControlInstance�() Unknown
    System_Windows_Forms_System_Windows_Forms_ToolStripScrollButton___ctor�() Unknown
    System_Windows_Forms_System_Windows_Forms_ToolStripDropDownMenu__get_UpScrollButton�() Unknown
    System_Windows_Forms_System_Windows_Forms_ToolStripDropDownMenu__SetDisplayedItems�() Unknown
    System_Windows_Forms_System_Windows_Forms_ToolStrip__OnLayout�() Unknown
    System_Windows_Forms_System_Windows_Forms_ToolStripDropDown__OnLayout�() Unknown
    System_Windows_Forms_System_Windows_Forms_ToolStripDropDownMenu__OnLayout�() Unknown
    System_Windows_Forms_System_Windows_Forms_Control__PerformLayout_1�() Unknown
    System_Windows_Forms_System_Windows_Forms_Control__PerformLayout�() Unknown
    System_Windows_Forms_System_Windows_Forms_Control__ResumeLayout_0�() Unknown
    System_Windows_Forms_System_Windows_Forms_Layout_LayoutTransaction__Dispose�() Unknown
    System_Windows_Forms_System_Windows_Forms_ToolStripItemCollection__AddRange�() Unknown
    System_Windows_Forms_System_Windows_Forms_ToolStripItemCollection__AddRange�() Unknown
    winforms_winforms_Form1__InitializeComponent() Line 80 Unknown
    winforms_winforms_Form1___ctor() Line 17 Unknown
    winforms_winforms_Program__Main() Line 17 Unknown

    I poked a bit blindly around the source code of WInForms and found this very suspicious code:

    Marshal.SizeOf(typeof(SafeNativeMethods.BITMAPINFOHEADER))

    I blindly tried some permutations inside rd.xml, similar to the following, but frankly, all this could have been latin incantations from the necronomicon, so I assume I did not do it correctly. I always received the same exception regardles of which assemblies I included in the list.

    <Assembly Name="System.Drawing.Common"  Dynamic="Required All" />
          <Assembly Name="System.Drawing.Primitives" Dynamic="Required All" />
          <Assembly Name="System.Windows.Forms" Dynamic="Required All" />
          <Assembly Name="mscorlib" Dynamic="Required All" />

    I'm leaving this in hope that someone could make sense of the issue.

  3. jkotas commented on Mar 21, 2020

    @jkotas
    Member

    Marshal.SizeOf(typeof(SafeNativeMethods.BITMAPINFOHEADER))

    You can submit PR to WinForms to change BITMAPINFOHEADER to struct and this line to sizeof(SafeNativeMethods.BITMAPINFOHEADER). It has significantly better performance everywhere, and it is guaranteed to be compatible with CoreRT.

  4. teobugslayer commented on Mar 21, 2020

    @teobugslayer
    Contributor

    Marshal.SizeOf(typeof(SafeNativeMethods.BITMAPINFOHEADER))

    You can submit PR to WinForms to change BITMAPINFOHEADER to struct and this line to sizeof(SafeNativeMethods.BITMAPINFOHEADER). It has significantly better performance everywhere, and it is guaranteed to be compatible with CoreRT.

    Even if I do it, how can I verify that this fixes the CoreRT issue? Or, more to the point, if I have built the System.WIndows.Forms and friends assemblies on my machine, how can I reference them from my test CoreRT project?

  5. Suchiman commented on Mar 21, 2020

    @Suchiman
    Contributor
  6. teobugslayer commented on Mar 21, 2020

    @teobugslayer
    Contributor

    I'd imagine the instructions in https://github.com/dotnet/winforms/blob/master/Documentation/debugging.md should work

    I suspect the rabbit hole is quite deep :D Challenge accepted! And thank you for the hint!

  7. MichalStrehovsky commented on Mar 23, 2020

    @MichalStrehovsky
    Member

    Marshal.SizeOf(typeof(SafeNativeMethods.BITMAPINFOHEADER))

    The fact that the compiler doesn't figure this one out is actually a dumb regression I caused when I was moving things around. Fixing this to use sizeof of a struct is still a very good fix (because it's really just so much faster to use sizeof), but I'm also submitting #8053 that should resolve this too.

  8. jkotas commented on Mar 23, 2020

    @jkotas
    Member

    Also, I have submitted the System.Drawing interop improvement as dotnet/runtime#33967

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions