I have some Java code that needs to be made available in an UWP-app and am using IKVM to compile a DLL of that code. That works pretty well in DEBUG-mode, but fails with different errors in RELEASE-mode and the then used .NET native toolchain:
Schweregrad Code Beschreibung Projekt Datei Zeile Unterdrückungszustand
Fehler Die Methode "WinFormsMessageLoop.Invoke(Delegate)" löst immer eine Ausnahme aufgrund der fehlenden Methode "Control.Invoke(Delegate)" aus in der Assembly "System.Windows.Forms" aus. Möglicherweise fehlt eine Assembly oder eine Abhängigkeit von einer neueren Windows SDK-Version. Ams.Oms.Poc
Fehler Der Typ "System.Windows.Forms.MenuItem" von der Assembly "System.Windows.Forms" war nicht in der Kompilierung enthalten, es wurde jedoch in "Typ "ikvm.awt.NetMenuPeer"" darauf verwiesen. Möglicherweise fehlt eine Assembly oder eine Abhängigkeit von einer neueren Windows SDK-Version. Ams.Oms.Poc
Fehler Der Typ "System.Windows.Forms.KeyEventHandler" von der Assembly "System.Windows.Forms" war nicht in der Kompilierung enthalten, es wurde jedoch in "Methode "NetComponentPeer.hookEvents()"" darauf verwiesen. Möglicherweise fehlt eine Assembly oder eine Abhängigkeit von einer neueren Windows SDK-Version. Ams.Oms.Poc
Fehler Der Typ "System.Drawing.Drawing2D.ColorBlend" von der Assembly "System.Drawing.Common" war nicht in der Kompilierung enthalten, es wurde jedoch in "Methode "NetGraphics.setPaint(Paint)"" darauf verwiesen. Möglicherweise fehlt eine Assembly oder eine Abhängigkeit von einer neueren Windows SDK-Version. Ams.Oms.Poc
[...]
Fehler Die Methode "NetWindowPeer.getGraphics()" löst immer eine Ausnahme aufgrund der fehlenden Methode "Control.get_ClientRectangle()" aus in der Assembly "System.Windows.Forms" aus. Möglicherweise fehlt eine Assembly oder eine Abhängigkeit von einer neueren Windows SDK-Version. Ams.Oms.Poc
Fehler Die Methode "NetToolkit.createImage(byte[], int, int)" löst immer eine Ausnahme aufgrund der fehlenden Methode "Bitmap..ctor(Stream)" aus in der Assembly "System.Drawing" aus. Möglicherweise fehlt eine Assembly oder eine Abhängigkeit von einer neueren Windows SDK-Version. Ams.Oms.Poc
Fehler Die Methode "NetMouseInfoPeer.fillPointWithCoords(Point)" löst immer eine Ausnahme aufgrund der fehlenden Methode "Cursor.get_Position()" aus in der Assembly "System.Windows.Forms" aus. Möglicherweise fehlt eine Assembly oder eine Abhängigkeit von einer neueren Windows SDK-Version. Ams.Oms.Poc
Simply disabling the usage of the native toolchain in the build settings of the RELEASE-mode resolves those problems, but the resulting app still can not be published in the app store:
Package acceptance validation error: This package wasn't built for submission to the Store. Make sure you're uploading a Release build with the .NET Native tool chain enabled.
The point is that I don't need any of the problematic native code for my own Java code, but instead all the problematic functions and references come from some GUI-related DLL of IKVM itself. I don't need that DLL as well, but for some reason it needs to be available in the project to fulfill dependencies or it can't be compiled in DEBUG-mode already. But nothing of that is needed during runtime in the end.
So I'm wondering if there's some step or setting or "trick" to remove native code BEFORE the native toolchain sees it and runs into errors somehow? Something like an additional filter or stuff like that.
Everything else seems to force me to change and fix those problems in IKVM somehow, which is non-trivial most likely as well. In the best case I'm able to simply comment the code not needed or make other DLLs not depend on the failing IKVM.OpenJDK.SwingAWT-DLL anymore or stuff like that.