Skip to content

Unhandled exception about "System.Drawing.Common is not supported on this platform" occurs when running winforms application #57791

Description

@Olina-Zhang
  • .NET Core Version:
    .Net 6.0 RC1 build: 6.0.100-rc.1.21418.27 from release/6.0.1xx-rc1 branch in https://github.com/dotnet/installer
    This is a regression issue, cannot repro previous .Net 6.0 build: 6.0.100-rc.1.21417.19

  • Have you experienced this same bug with .NET Framework?:
    No

Minimal repro:

  1. Create a Winforms .Net 6.0 application
  2. Build and run app

Expected behavior:
Form designer can be loaded successfully, Build and run app successfully

Actual behavior:

  1. Form designer is still in loading state
  2. Run app failed with an exception: "System.Drawing.Common is not supported on this platform"
    image

System.PlatformNotSupportedException
HResult=0x80131539
Message=System.Drawing.Common is not supported on this platform.
Source=System.Drawing.Common
StackTrace:
at System.Drawing.SystemFonts.get_MessageBoxFont()
at System.Windows.Forms.Control.get_DefaultFont()
at System.Windows.Forms.Control.GetDefaultFontHandleWrapper()
at System.Windows.Forms.Control.get_FontHandle()
at System.Windows.Forms.ContainerControl.GetFontAutoScaleDimensions()
at System.Windows.Forms.ContainerControl.get_CurrentAutoScaleDimensions()
at System.Windows.Forms.ContainerControl.get_AutoScaleFactor()
at System.Windows.Forms.ContainerControl.PerformAutoScale(Boolean includedBounds, Boolean excludedBounds, Boolean causedByFontChanged)
at System.Windows.Forms.ContainerControl.PerformNeededAutoScaleOnLayout()
at System.Windows.Forms.Form.OnLayout(LayoutEventArgs levent)
at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement, String affectedProperty)
at System.Windows.Forms.ContainerControl.LayoutScalingNeeded()
at System.Windows.Forms.ContainerControl.set_AutoScaleMode(AutoScaleMode value)
at WinFormsApp31.Form1.InitializeComponent() in C:\Users\v-olzhan\source\repos\WinFormsApp31\WinFormsApp31\Form1.Designer.cs:line 32
at WinFormsApp31.Form1..ctor() in C:\Users\v-olzhan\source\repos\WinFormsApp31\WinFormsApp31\Form1.cs:line 17
at WinFormsApp31.Program.Main() in C:\Users\v-olzhan\source\repos\WinFormsApp31\WinFormsApp31\Program.cs:line 20

Activity

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions