Skip to content

Error: QRCode does not contain a Constructor that takes 1 argument #360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sonisp opened this issue Dec 8, 2021 · 6 comments
Closed

Error: QRCode does not contain a Constructor that takes 1 argument #360

sonisp opened this issue Dec 8, 2021 · 6 comments
Labels

Comments

@sonisp
Copy link

sonisp commented Dec 8, 2021

Hi,
I have downloaded and installed the Nuget Package QRCoder 1.4.2 and when I am trying to use the Constructor I am getting the below two bugs.

Type of issue

Bug 1: QRCode does not contain a Constructor that takes 1 argument . Attached reference QRCode_Constructor_Bug.png
Bug 2: QRCode does not contain a definition for GetGraphic and no accessible method..etc. Attached reference QRCode_GetGraphic_Bug.png

Steps to Reproduce (for bugs)

  1. Install Nuget Pacakge QRCoder (ver 1.4.2) in Visual Studio Console App.
  2. Copy code from GIT Sample

Your Environment

  1. QRCoder (ver 1.4.2)
  2. Visual Studio 2019
  3. Console App . Net Framework 4.7.2
  4. Windows 10

QRCode_Constructor_Bug

QRCode_GetGraphic_Bug

@codebude
Copy link
Owner

codebude commented Dec 8, 2021

Hi @sonisp ,

the errors look a little bit strange. Can you please show/post the part of your code with the using-statements? Have you added any other library, that contains a class named "QRCode"?

I tried to reproduce the error and created a minimal project (VS2022, .NET4.7.2, QRCoder 1.4.2) with the following code and everything worked as expected:

using QRCoder;
using System.Drawing;

namespace ConsoleAppQRCodeTest
{
    internal class Program
    {
        static void Main(string[] args)
        {
            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);

            System.Console.WriteLine("Successfully generated QR code.\nPress <any> key to end the program.");
            System.Console.ReadKey();
        }
    }
}

Feel free to download my test project and try it yourself. If it runs, there must be another error in your app: ConsoleAppQRCodeTest.zip

@codebude
Copy link
Owner

codebude commented Dec 9, 2021

Hi @sonisp ,

could you try out my sample project and if so, does it run on your environment?

@sonisp
Copy link
Author

sonisp commented Dec 10, 2021

Hi @codebude, will try and revert. Ty

@codebude
Copy link
Owner

Since I haven't heard anything, I guess it worked out and will close the issue now. If you still have problems, let me know, then we can re-open the issue.

@jianliulin
Copy link

jianliulin commented Dec 15, 2021

<TargetFramework>net6.0-windows</TargetFramework>  is ok

<TargetFramework>net6.0</TargetFramework>  is error

It may be caused here:
image

@codebude
Copy link
Owner

@jianliulin it can't work in net6.0... #361 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants