From 8e81d36246e3c71d10d76eddec28e4b9b3fd6447 Mon Sep 17 00:00:00 2001 From: Shane Krueger Date: Fri, 10 Oct 2025 13:28:23 -0400 Subject: [PATCH 1/4] Add troubleshooting section for System.Drawing.Common warnings in README --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index 63bb3734..d3202742 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,27 @@ for (int y = 0; y < size; y++) } ``` +## 🔧 Troubleshooting + +### System.Drawing.Common Warnings (QRCode and ArtQRCode renderers) + +The `QRCode` and `ArtQRCode` renderers depend on `System.Drawing.Common`, which Microsoft has [removed cross-platform support for in .NET 6+](https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/system-drawing-common-windows-only). You may encounter one of the following build or runtime errors: + +``` +CA1416: This call site is reachable on all platforms. 'QRCode.QRCode(QRCodeData)' is only supported on: 'windows' + +System.TypeInitializationException: The type initializer for 'Gdip' threw an exception. + +System.PlatformNotSupportedException: System.Drawing.Common is not supported on this platform. +``` + +**Solutions:** + +1. Use Windows-specific TFMs such as `net8.0-windows` +2. Mark methods with the `[SupportedOSPlatform("windows")]` attribute +3. Add platform guards by wrapping code with `#if WINDOWS` or `if (OperatingSystem.IsWindows())` +4. Use cross-platform renderers: `PngByteQRCode`, `SvgQRCode`, or `BitmapByteQRCode` + ## 🚀 CI Builds The NuGet feed contains only **major/stable** releases. If you want the latest functions and features, you can use the CI builds [via Github packages](https://github.com/Shane32/qrcoder/packages). From ba6554cd0a590f77f7032e791a1a926690463997 Mon Sep 17 00:00:00 2001 From: Shane Krueger Date: Fri, 10 Oct 2025 13:29:37 -0400 Subject: [PATCH 2/4] Update troubleshooting section header to use warning emoji --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d3202742..a5be01fe 100644 --- a/README.md +++ b/README.md @@ -174,7 +174,7 @@ for (int y = 0; y < size; y++) } ``` -## 🔧 Troubleshooting +## ⚠️ Troubleshooting ### System.Drawing.Common Warnings (QRCode and ArtQRCode renderers) From 0f2f99f68fcfb33e7a96277c7372f6f56475b449 Mon Sep 17 00:00:00 2001 From: Shane Krueger Date: Fri, 10 Oct 2025 13:31:22 -0400 Subject: [PATCH 3/4] Clarify solutions for System.Drawing.Common platform compatibility in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a5be01fe..c2a494be 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,7 @@ System.TypeInitializationException: The type initializer for 'Gdip' threw an exc System.PlatformNotSupportedException: System.Drawing.Common is not supported on this platform. ``` -**Solutions:** +Solutions include: 1. Use Windows-specific TFMs such as `net8.0-windows` 2. Mark methods with the `[SupportedOSPlatform("windows")]` attribute From dd0053a48ae96e5b802fe890dd940e917bcee5a5 Mon Sep 17 00:00:00 2001 From: Shane Krueger Date: Fri, 10 Oct 2025 13:49:18 -0400 Subject: [PATCH 4/4] Apply suggestion from @Shane32 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c2a494be..e28a779b 100644 --- a/README.md +++ b/README.md @@ -193,7 +193,7 @@ Solutions include: 1. Use Windows-specific TFMs such as `net8.0-windows` 2. Mark methods with the `[SupportedOSPlatform("windows")]` attribute 3. Add platform guards by wrapping code with `#if WINDOWS` or `if (OperatingSystem.IsWindows())` -4. Use cross-platform renderers: `PngByteQRCode`, `SvgQRCode`, or `BitmapByteQRCode` +4. Use cross-platform renderers such as `PngByteQRCode`, `SvgQRCode`, or `BitmapByteQRCode` ## 🚀 CI Builds