Skip to content

Sample code fails - "QRCode" doesn't exist #475

Closed
@markdall

Description

@markdall

Type of issue

[x ] Bug

Expected Behavior

Sample code from readme.md works in VS 2022 LTSC 17.6 / .NET 6.0

Sample code from readme.md:

QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode("The text which should be encoded.", QRCodeGenerator.ECCLevel.Q);
QRCode qrCode = new QRCode(qrCodeData);
Bitmap qrCodeImage = qrCode.GetGraphic(20);

Current Behavior

Severity	Code	Description	Project	File	Line	Suppression State
Error	CS0246	The type or namespace name 'QRCode' could not be found (are you missing a using directive or an assembly reference?

Possible Solution (optional)

QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode("The text which should be encoded.", QRCodeGenerator.ECCLevel.Q);
BitmapByteQRCode bitmapQRCode = new BitmapByteQRCode(qrCodeData);
File.WriteAllBytes("output.bmp", bitmapQRCode.GetGraphic(20));

Steps to Reproduce (for bugs)

Use the current sample code first found by starting at the top of the Readme.md file and scrolling down, in VS 2022. "QRCode" doesn't seem to exist anymore.

Your Environment

  • Version used: 1.4.3
  • Compiled from source or NuGet package?: NuGet
  • Payload/Encoded text: "The text which should be encoded."
  • Used payload generator: QRCodeGenerator
  • Used ECC-level: QRCodeGenerator.ECCLevel.Q
  • Used renderer class: Not sure what that is.
  • .NET 6.0

I'd make a pull request with my version that works (see: possible solution) but I'm not an actual developer and my solution may have everyone who reads it slapping their foreheads in dismay at my folly. I mostly just wanted to point out that the sample code doesn't work, likely because the name space or class name was changed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions