Closed peterlukerow closed 3 years ago
might be good to use ImageSharp instead of System.Drawing.
I used it for another similar project. If interested i could possibly implement it in a pull request
Agree, having dependency to System.Drawing
making it less usable for .net standard. I intend to use it in blazor it's not possible to do that due to this dependency to System.Drawing
.
@peterlukerow Not all of the rendering classes use System.Drawing
. If you want to avoid the usage of System.Drawing
you could e.g. use one of the following renderer classes, which don't have references to System.Drawing
:
@codebude that's good to know.
Don't need to use it yet as there is still some project wrangling going on and this was just my reconnaissance. Hopefully if I do get to the point of using it the System.Drawing issue will have been resolved.
I am using it in a ASP.net proyect with System.Drawing and it work ok
I am using it in a ASP.net proyect with System.Drawing and it work ok
It's not that it won't work that is a problem it's that it can lead to memory leaks when used in ASP.NET - see my original opening question that quotes the Microsoft documentation.
Currently I'm not planning to move away from System.Drawing. For ASP.NET a bunch of rendering classes without usage of System.Drawing are available.
Currently I'm not planning to move away from System.Drawing. For ASP.NET a bunch of rendering classes without usage of System.Drawing are available.
Having to explicitly check the source code kind of defeats the point of using a library which should be treated as a black box. Perhaps restructure the project into multiple DLLs so you have Core and Web. Thus anything in the Web DLL will not use System.Drawing for example, that way it's easy to only reference the parts that should be safe to use.
Hi @peterlukerow ,
I'll take your arguments into the discussion in https://github.com/codebude/QRCoder/issues/242 I guess the motivation of this issue is the same.
Question
Microsoft's documentation says: https://docs.microsoft.com/en-us/dotnet/api/system.drawing?view=netframework-4.7.2 "Classes within the System.Drawing namespace are not supported for use within a Windows or ASP.NET service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions. For a supported alternative, see Windows Imaging Components."
I looked at the code for QrCode and see that it is using System.Drawning. Do you have any plans to release a version that can be used on an ASP.NET MVC project (full fat .NET framework)?