Repository navigation
Generate QR Codes With QRCoder: .NET 10, QRCoder 1.8.0, SVG renderer - #2279
Open
vladimir-pecanac-main wants to merge 1 commit into
Conversation
Retarget both projects to net10.0 and bump QRCoder to 1.8.0 and the test packages. GeneratePng renders black on white again; the coloured call moves to GeneratePngBranded. Add GenerateQRCodeSvg with SvgQRCode. QrCodesDb uses ConcurrentDictionary with TryAdd. Drop the stray semicolon on @model, switch to MapStaticAssets, and add PNG and SVG output tests.
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.
Article: https://code-maze.com/aspnetcore-generate-qr-codes-with-qrcoder/
Updates the QRCoder sample for the article refresh. Only
dotnet-client-libraries/QRCoderchanges.GeneratePng()renders black on white again withGetGraphic(20), which is what the article's first screenshots show. The red on dark blue call moves to a separateGeneratePngBranded()method with its own "Branded" entry, which the article's Colors section points at.GenerateQRCodeSvg()method and "SVG" entry, rendering the same text withSvgQRCodeas adata:image/svg+xmlURI.QrCodesDbis registered as a singleton, so its store becomes aConcurrentDictionary<string, byte[]>andAddusesTryAdd(noContainsKeyplusAddrace).@model HomeModel;loses the stray semicolon.Program.csusesMapStaticAssets()and.WithStaticAssets()like the .NET 10 MVC template, in place ofUseStaticFiles().No
usingwas added to anyCreateQrCode()result: disposing the renderer already disposes theQRCodeDatait was given.Package versions, re-queried on NuGet on 2026-10-10 (latest stable):
Local run on SDK 10.0.302, runtime 10.0.10: build 0 warnings and 0 errors, 3 of 3 tests passed,
dotnet list package --vulnerable --include-transitiveclean on both projects. The app was run and all six images decoded in a browser.