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)
- New project
- Target .NET 6.0
- Reference QRCoder 1.4.3
- 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
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]
thanks , I can’t find class QRCode in 1.4.3 , 1.4.1 is fine!