Repository navigation
fix: default-enable System.Drawing.EnableUnixSupport for .NET (Core) consumers - #842
Closed
cassianomansano wants to merge 1 commit into
Closed
cassianomansano wants to merge 1 commit into
cassianomansano wants to merge 1 commit into
Conversation
…T (Core) consumers Not proposed upstream (yet) - this is a local-fork patch, kept independent of the upstream review/merge cycle per our own CI PR backlog finding (oldest open PR there is from 2024). FastReport's engine is built on System.Drawing.Common/GDI+ (see the _FR_GraphicsEngine=GDIPlus property right above this change). Since .NET 6, that package throws PlatformNotSupportedException on any non-Windows host unless an app-level AppContext switch is set - every consumer of the official package hits that exception on Linux with zero indication why, since nothing in this repo sets or documents the switch. This patches the NuGet build-props shipped inside the FastReport.OpenSource package (Pack/FastReport.OpenSource/build/FastReport.OpenSource.props) to set RuntimeHostConfigurationOption System.Drawing.EnableUnixSupport=true for any .NETCoreApp consumer, transitively, with no action required on the consumer's part. No-op on Windows. Does NOT fix the deeper issue: Linux hosts still need libgdiplus installed natively for GDI+ calls to actually succeed once the exception is gone. Validated locally end-to-end (packed to a local feed, consumed from a throwaway console app, compared runtimeconfig.json against the official 2026.2.8 package from nuget.org): official package -> configProperties has no System.Drawing.EnableUnixSupport key patched package -> configProperties["System.Drawing.EnableUnixSupport"] = true
Author
|
Fechando pelo mesmo motivo do #841 — spike técnico, não PR real. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The engine is built on
System.Drawing.Common/GDI+ (see_FR_GraphicsEngine = GDIPlusinPack/FastReport.OpenSource/build/FastReport.OpenSource.props). Since .NET 6, that package throwsPlatformNotSupportedExceptionon any non-Windows host unless the app sets theSystem.Drawing.EnableUnixSupportAppContext switch itself. Nothing in this repo sets or documents that switch, so every consumer on Linux hits the exception with zero indication why — this is a real, structural risk for the "cross-platform .NET 6" claim in the README, not just a theoretical one.Fix
Patch the MSBuild props file this repo already ships inside the
FastReport.OpenSourceNuGet package (Pack/FastReport.OpenSource/build/FastReport.OpenSource.props) to add:This flows transitively into any
.NETCoreAppconsumer'sruntimeconfig.jsonwith zero action on their part. No-op on Windows (GDI+ is native there already).This does not fully solve cross-platform support — Linux hosts still need
libgdiplusinstalled natively for GDI+ calls to actually succeed once the exception is removed. It removes the silent, undocumented trap; it doesn't make GDI+ itself portable.Validated locally before opening this PR
Packed the patched
FastReport.OpenSourceto a local NuGet feed, referenced it from a throwaway console app vianuget.config, and diffed the generatedruntimeconfig.jsonagainst a second app referencing the official2026.2.8package from nuget.org:dotnet buildof the full solution still succeeds with this change (Windows runner, same validation as #841).Test plan
FastReport.Compat/FastReport.OpenSource.csprojdirectly) — open to moving it if there's a preferred spot