ststeiger / PdfSharpCore

Port of the PdfSharp library to .NET Core - largely removed GDI+ (only missing GetFontData - which can be replaced with freetype2)
Other
1.06k stars 236 forks source link

UWP app crashes when compiling with .NET Native tool chain enabled #280

Open ktdev1 opened 2 years ago

ktdev1 commented 2 years ago

Application crashes on startup with the following error message displayed in a popup window:

An Issue in the projectname.UWP.exe process has caused it to fail to activate. This process exited with a native exception. To debug the issue, open project properties, and configure the project to run under a native debugger. More information can be found in the Debug pane of the Output Window (Debug->Windows->Output).

The application Output Window shows the following errors:

The program '[13004] projectname.UWP.exe' has exited with code -1073741515 (0xc0000135) 'A dependent dll was not found'. Activation of the Windows Store app 'projectname_gqzyd64fk25xj!App' failed with error 'The target process aborted before activation completed. More information may be available in the Debug pane of the Output window (Debug->Windows->Output)'. Activation of the Windows Store app 'projectname_gqzyd64fk25xj!App' failed with error 'The app didn't start'.

This issue can be replicated by doing the following:

  1. Create a new Blank Xamarin.Forms project for UWP only. (Uncheck iOS and Android.)
  2. Install the PdfSharpCore (v1.3.32) NuGet package into the common project.
  3. Run the application from Visual Studio (currently using the 2019 version) in Release mode.

If you disable "Compile with .NET Native tool chain" option in the UWP Build window under Properties, then this error goes away. However, our project requires us to have this enabled in order to fully remove debug dependencies from the installer. Are there any workarounds for using this package with .NET Native tool chain enabled?

DilanBoskan commented 1 year ago

There is a breaking change for UWP compiled with .NET Toolchain somewhere between 1.3.7 - now (No idea where exactly). Consider switching to 1.3.7 so that you can compile the app with the .NET Toolchain.

Kbmobi commented 1 year ago

I have the exact same issue listed. Downgrading the nuget to 1.3.7 working for me. Thank you.