Skip to content
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

System.ArgumentNullException: 'Parameter "name" must be not null. (Parameter 'name')' #39

Open
joost00719 opened this issue Sep 6, 2023 · 2 comments

Comments

@joost00719
Copy link

I am trying to generate an image using the NetBarcode library.
However I get a ArgumentNullException.
My code looks like this:

    var bc = new NetBarcode.Barcode(code, NetBarcode.Type.EAN13, true);
    var b64 = bc.GetBase64Image();

Am I doing something wrong, or is there an error in the library?
I am running this in Blazor (server side). .NET version 7.0

Thanks in advance!

image

@joost00719
Copy link
Author

If I pass false to showLabel in the constructor, it works fine.
It is not blocking my use case now, but I think this is a bug.

@ahoachuck
Copy link

ahoachuck commented Feb 10, 2025

I got the same issue. It seems to happen when NetBarcode can't find a default font to use for text.
Try to specify a font for NetBarcode to use.

Edit: In my case, it looks like 'defaultFont' is not null (hence why the null check is skipped), but when trying to print out the name, it's empty.

Image
Image

Barcode.cs, L745

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

No branches or pull requests

2 participants