Issue
The change in commit b45be40 removed the use of SvgRenderer.Color struct for the .NETStandard2.0 version of the ZXing.Net library in favor of System.Drawing.Color for the SvgRenderer.Foreground and SvgRenderer.Background. The .NET5+ versions of the ZXing.Net library still uses the SvgRenderer.Color struct for these properties.
The issue becomes if you create a .NETStandard2.0 library that uses ZXing.Net it will use System.Drawing.Color to set the SvgRenderer.Foreground or SvgRenderer.Background. If you then consume this library in an application that targets .NET5+ it will use the ZXing.Net version that instead uses SvgRenderer.Color. Because of this mismatch at runtime you get an exception of type or similar to System.MissingMethodException : Method not found: 'Void ZXing.Rendering.SvgRenderer.set_Background(System.Drawing.Color)'..
Background
.NETStandard is meant to conform to the consuming .NET framework, so having this mismatch in method signatures breaks that contract. Either .NET5+ needs to be made to also use System.Drawing.Color or the .NETStandard2.0 needs to be reverted to use SvgRenderer.Color.
The same issue would apply to PixelDataRenderer as well as .NETCore targeted apps. Both would be fixed with the below suggested change. It looks like .NETFramework4.6+ correctly conforms with the use of System.Drawing.Color. I didn't look into the other older or less used frameworks. For more on what frameworks of .NET need to support .NETStandard2.0 is found here. https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0#select-net-standard-version
Proposed Fix
The underlying issue may be that the intention was that .NET5+ would conform to .NETStandard2.0 choice for using System.Drawing.Color, but the pre-processor condition NETSTANDARD2_0_OR_GREATER is not defined in the csproj file. Any place in https://github.com/micjahn/ZXing.Net/blob/master/Source/lib/netstandard/ZXing.Net.csproj that manually defines NETSTANDARD2_0 also needs to manually define NETSTANDARD2_0_OR_GREATER. The _OR_GREATER definition isn't given for free here since NETSTANDARD2_0 is being manually defined for .NET target frameworks that would otherwise not define it.
e.g.
<PropertyGroup Condition="'$(TargetFramework)'=='net5.0'">
<DefineConstants>$(DefineConstants);NETSTANDARD2_0;NETSTANDARD2_0_OR_GREATER</DefineConstants>
</PropertyGroup>
Issue
The change in commit b45be40 removed the use of
SvgRenderer.Colorstruct for the .NETStandard2.0 version of the ZXing.Net library in favor ofSystem.Drawing.Colorfor theSvgRenderer.ForegroundandSvgRenderer.Background. The .NET5+ versions of the ZXing.Net library still uses theSvgRenderer.Colorstruct for these properties.The issue becomes if you create a .NETStandard2.0 library that uses ZXing.Net it will use
System.Drawing.Colorto set theSvgRenderer.ForegroundorSvgRenderer.Background. If you then consume this library in an application that targets .NET5+ it will use the ZXing.Net version that instead usesSvgRenderer.Color. Because of this mismatch at runtime you get an exception of type or similar toSystem.MissingMethodException : Method not found: 'Void ZXing.Rendering.SvgRenderer.set_Background(System.Drawing.Color)'..Background
.NETStandard is meant to conform to the consuming .NET framework, so having this mismatch in method signatures breaks that contract. Either .NET5+ needs to be made to also use
System.Drawing.Coloror the .NETStandard2.0 needs to be reverted to useSvgRenderer.Color.The same issue would apply to
PixelDataRendereras well as .NETCore targeted apps. Both would be fixed with the below suggested change. It looks like .NETFramework4.6+ correctly conforms with the use ofSystem.Drawing.Color. I didn't look into the other older or less used frameworks. For more on what frameworks of .NET need to support .NETStandard2.0 is found here. https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0#select-net-standard-versionProposed Fix
The underlying issue may be that the intention was that .NET5+ would conform to .NETStandard2.0 choice for using
System.Drawing.Color, but the pre-processor conditionNETSTANDARD2_0_OR_GREATERis not defined in the csproj file. Any place in https://github.com/micjahn/ZXing.Net/blob/master/Source/lib/netstandard/ZXing.Net.csproj that manually definesNETSTANDARD2_0also needs to manually defineNETSTANDARD2_0_OR_GREATER. The_OR_GREATERdefinition isn't given for free here sinceNETSTANDARD2_0is being manually defined for .NET target frameworks that would otherwise not define it.e.g.