QRCoder: .NET 6.0 - TypeLoadException

Type of issue

[X] Bug
[ ] Question (e.g. about handling/usage)
[ ] Request for new feature/improvement

Expected Behavior

Should load the assembly.

Current Behavior

Referencing the library throws a TypeLoadException, with zero information. This happens when targeting .NET 6.0, and the actual dll copied to the bin folder is that of the .NET 6.0 (~120KB).
When overwriting with the .NET Standard dll, or the .NET 5.0 dll - it works.

Possible Solution (optional)

Recompile?

Steps to Reproduce (for bugs)

  1. New project
  2. Target .NET 6.0
  3. Reference QRCoder 1.4.3
  4. Reference any class from the library

Your Environment

  • Version used: 1.4.3
  • Compiled from source or NuGet package?: NuGet
  • Payload/Encoded text:
  • Used payload generator:
  • Used ECC-level:
  • Used renderer class:
  • Environment (.NET 3.5, .NET 4.X, .NETCore, …): .NET 6.0 –>

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 22
  • Comments: 25

Most upvoted comments

all works fine with version Include=“QRCoder” Version=“1.4.1”

You can enable System.Drawing for .NET 6. It’s disabled by default because some features are not available cross-platform, but this library does not use any of those.

My issue was also not detecting the QRCode class, So rolling back to version 1.4.1 worked for me.

If you have another issue I am not sure if rolling the version back will work

@willshoemaker thanks for your comment

You can set option of your project to run on ‘Windows’ target Right clic on your project -> properties -> Application/General/TargetOs [Windows] image

all works fine with version Include=“QRCoder” Version=“1.4.1”

thanks , I can’t find class QRCode in 1.4.3 , 1.4.1 is fine!