Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using VS 2013 and trying to use ZXing.NET.0.14.0.0 implementation from zxingnet.codeplex.com to create QRCodes. I am getting the error QRCodeWriter.cs not found when executing the code below. Here are the specifics of the error;

Source Not Found
QRCodeWriter.cs not found
You need to find QRCodeWriter.cs to view the source for the current call stack frame
Try one of the following options:
-Browse and find QRCodeWriter.cs...
You can view disassembly in the Disassembly window. To always view disassembly for missing source files. change the setting in the Options dialog.
Source search information
** Here it looks like it is searching through directories to find the file
QRCodeWriter is the method first being used in the example, which is all I am using. Not sure why it's looking for the .cs file though.

Here is the sample code. It is failing on the encode line (3rd line in the 1st example) with the error above.

C#
using ZXing.QrCode;
using ZXing.QrCode.Internal;

namespace QRCodeTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
		QRCodeWriter qr = new ZXing.QrCode.QRCodeWriter();
		string url = "http://www.bing.com/";
		var matrix = qr.encode(url, BarcodeFormat.QR_CODE, 200, 200); //Failing here
		ZXing.BarcodeWriter w = new ZXing.BarcodeWriter();
		w.Format = ZXing.BarcodeFormat.QR_CODE;
		Bitmap img = w.Write(matrix);
		img.Save(@"C:\Users\Frank\Documents\myQR.png", System.Drawing.Imaging.ImageFormat.Png);
        }
    }
}


Hopefully someone a lot smarter than me can tell me what I am doing wrong here. Thanks in advance!
Posted

it looks like its looking for the .cs code to show you the source of 'an error'
I'd be looking at

QRCodeWriter qr = new ZXing.QrCode.QRCodeWriter();


and wrapping it with a try/catch and/or null test to see if 'qr' is a valid object - btw, do you really need to do

ZXing.QrCode.QRCodeWriter()


? I note in their example http://zxingnet.codeplex.com/SourceControl/latest#trunk/Source/test/src/qrcode/QRCodeWriterTestCase.cs[^] if you have the correct 'using' statements, you should be able to do this

QRCodeWriter writer = new QRCodeWriter();



this may not be helpful - sorry
 
Share this answer
 
Thanks for looking! Yeah sorry. That was me trying something different and I just forgot to change it back. The code to instantiate the object should be
C#
QRCodeWriter qr = new QRCodeWriter();


which still doesn't work.

If I remove
C#
using ZXing.QRCode;

It tells me in the Error List that "the type or namespace name QRCodeWriter could not be found (are you missing or using directive or an assembly reference?)"
and in that example you pointed to it does not include that which is curious. I put it back and no design time errors but I still get the same runtime error.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900