ikvmnet / ikvm

A Java Virtual Machine and Bytecode-to-IL Converter for .NET
Other
1.15k stars 109 forks source link

System.PlatformNotSupportedException: System.Drawing.Common is not supported on non-Windows platforms. See https://aka.ms/systemdr #516

Closed The-MAZZTer closed 2 months ago

The-MAZZTer commented 2 months ago

When trying to use Apache Tika with IKVM 8.7.6 on RHEL7 under .NET 6.

IKVM should not be trying to use System.Drawing.Common as a shim on non-Windows platforms.

System.TypeInitializationException: The type initializer for 'org.apache.pdfbox.pdmodel.PDDocument' threw an exception.
 ---> System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
 ---> System.PlatformNotSupportedException: System.Drawing.Common is not supported on non-Windows platforms. See https://aka.ms/systemdrApr 17 16:48:15 crhldvhelios01 TechAssistService[7050]: at System.Drawing.LibraryResolver.EnsureRegistered()
 at System.Drawing.SafeNativeMethods.Gdip.PlatformInitialize()
 at System.Drawing.SafeNativeMethods.Gdip..cctor()
 --- End of inner exception stack trace ---
 at System.Drawing.SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(Int32 width, Int32 height, Int32 stride, Int32 format, IntPtr scan0,Apr 17 16:48:15 crhldvhelios01 TechAssistService[7050]: at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
 at java.awt.image.BufferedImage.createBitmap(Int32 width, Int32 height)
 at java.awt.image.BufferedImage..ctor(Int32 width, Int32 height, Int32 imageType)
 at org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB.toRGBImage(WritableRaster raster)
 at org.apache.pdfbox.pdmodel.PDDocument..cctor()
 --- End of inner exception stack trace ---
 at org.apache.pdfbox.pdmodel.PDDocument.load(InputStream input, String password, MemoryUsageSetting memUsageSetting)
 at org.apache.tika.parser.pdf.PDFParser.getPDDocument(InputStream inputStream, String password, MemoryUsageSetting memoryUsageSetting, 
 at org.apache.tika.parser.pdf.PDFParser.parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context)     
 at org.apache.tika.parser.CompositeParser.parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context)  
 at org.apache.tika.parser.CompositeParser.parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context)   
 at org.apache.tika.parser.AutoDetectParser.parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context)  
 at <mycode>
wasabii commented 2 months ago

Duplicate of #381.