You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unhandled exception about "System.Drawing.Common is not supported on this platform" occurs when running winforms application #57791
Have you experienced this same bug with .NET Framework?:
No
Minimal repro:
Create a Winforms .Net 6.0 application
Build and run app
Expected behavior:
Form designer can be loaded successfully, Build and run app successfully
Actual behavior:
Form designer is still in loading state
Run app failed with an exception: "System.Drawing.Common is not supported on this platform"
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
We did change 2ccf787 however that should only apply on Unix. @ViktorHofer perhaps something changed in how we share this binary with WinForms to give them the wrong implementation?
I can confirm this. Rather than picking up the Windows implementations WindowsDesktop is getting the RID-less implementations. @ViktorHofer I think it's due to this:
@ViktorHofer , according to @mmitche , this fix should be in the latest RC2. I am not sure how the internal Microsoft.Internal.Runtime.WindowsDesktop.Transport packaging version update play a role here but functionally, this issue is not fixed in RC2. @ericstj.
Also, on a separate note, for RC1, .Net core applications targeting .NET 6.0 are throwing following:
@dreddy-work I just checked dotnet-sdk-6.0.100-rc.2.21428.9-win-x64.zip and it has the fix. If you are still facing issues please double check that you're using the latest build and open a new issue with repro steps. Make sure you include the exact version of the SDK you are using so that we can ensure we're looking at the same thing.
For the separate issue, same thing applies: ensure clear repro steps with versions and open a new issue. If I had to guess, that looks to me like a case where the SDK is writing one version to the runtimeconfig that doesn't match the shared framework which was installed. I can imagine a case where this might happen if you're swapping builds out for an app without rebuilding everything.
@dreddy-work@ericstj, verified the issue with latest .NET 6.0.100-rc.2.21428.23 build, the issue has been fixed that the core project targeting latest 6.0 rc2 can running successfully.
Thanks for all your help 👍 .
ghost locked as resolved and limited conversation to collaborators on Sep 29, 2021
Activity
dreddy-work commentedon Aug 19, 2021
@Olina-Zhang , is this the case with
mainas well?dreddy-work commentedon Aug 19, 2021
@safern, do you know anything changed in RC for Drawing.Common?
ericstj commentedon Aug 19, 2021
We did change 2ccf787 however that should only apply on Unix. @ViktorHofer perhaps something changed in how we share this binary with WinForms to give them the wrong implementation?
ericstj commentedon Aug 19, 2021
I can confirm this. Rather than picking up the Windows implementations WindowsDesktop is getting the RID-less implementations. @ViktorHofer I think it's due to this:
runtime/src/libraries/Microsoft.Internal.Runtime.WindowsDesktop.Transport/src/Microsoft.Internal.Runtime.WindowsDesktop.Transport.proj
Line 3 in 948770a
tarekgh commentedon Aug 20, 2021
@ViktorHofer I have labeled this issue as infrastructure and 6.0 milestone. Feel free to label it back to System.Drawing if this is not the case.
Olina-Zhang commentedon Aug 20, 2021
For the latest builds today, both of .Net 6.0 RC1 and RC2 have this issue, cannot find main branch to verify.

ViktorHofer commentedon Aug 20, 2021
The fix went into dotnet/runtime and will automatically flow into wimdowsdesktop which will fix this.
Sorry for the inconvenience.
Olina-Zhang commentedon Aug 27, 2021
Verified this issue in the latest .Net 6.0 RC2 and RC1 builds from https://github.com/dotnet/installer, RC2 still repro, RC1 is fixed, will continue monitoring the RC2 next builds to see if fix flows into.

dreddy-work commentedon Aug 27, 2021
@ViktorHofer , according to @mmitche , this fix should be in the latest RC2. I am not sure how the internal
Microsoft.Internal.Runtime.WindowsDesktop.Transportpackaging version update play a role here but functionally, this issue is not fixed in RC2. @ericstj.Also, on a separate note, for RC1, .Net core applications targeting .NET 6.0 are throwing following:
ericstj commentedon Aug 28, 2021
@dreddy-work I just checked dotnet-sdk-6.0.100-rc.2.21428.9-win-x64.zip and it has the fix. If you are still facing issues please double check that you're using the latest build and open a new issue with repro steps. Make sure you include the exact version of the SDK you are using so that we can ensure we're looking at the same thing.
For the separate issue, same thing applies: ensure clear repro steps with versions and open a new issue. If I had to guess, that looks to me like a case where the SDK is writing one version to the runtimeconfig that doesn't match the shared framework which was installed. I can imagine a case where this might happen if you're swapping builds out for an app without rebuilding everything.
Zheng-Li01 commentedon Aug 30, 2021
@dreddy-work @ericstj, verified the issue with latest .NET 6.0.100-rc.2.21428.23 build, the issue has been fixed that the core project targeting latest 6.0 rc2 can running successfully.
Thanks for all your help 👍 .