picoe / Eto

Cross platform GUI framework for desktop and mobile applications in .NET
Other
3.67k stars 335 forks source link

Default Wpf NET 5 'single file' + 'trim' crashes on start #1996

Closed LaraSQP closed 3 years ago

LaraSQP commented 3 years ago

Thought you might want to know.

The Wpf default app (here EtoNet5) runs fine without the trimming.

With trimming, the app crashes.

This is Eto.Forms 2.5.11

The publish profile FolderProfile.pubxml is as follows:

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration>Release</Configuration>
    <Platform>Any CPU</Platform>
    <PublishDir>bin\Release\net5.0-windows7.0\publish\</PublishDir>
    <PublishProtocol>FileSystem</PublishProtocol>
    <TargetFramework>net5.0-windows7.0</TargetFramework>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
    <SelfContained>true</SelfContained>
    <PublishSingleFile>True</PublishSingleFile>
    <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
    <PublishReadyToRun>False</PublishReadyToRun>
    <PublishTrimmed>True</PublishTrimmed>
  </PropertyGroup>
</Project>

The windows event log produces three items:

Application: EtoNet5.Wpf.exe
CoreCLR Version: 5.0.721.25508
.NET Version: 5.0.7
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeInitializationException: The type initializer for 'System.Windows.Media.FontFamily' threw an exception.
 ---> System.IO.FileNotFoundException: 
File name: 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at MS.Internal.FontCache.FamilyCollection.FromWindowsFonts(Uri folderUri)
   at System.Windows.Media.FontFamily.PreCreateDefaultFamilyCollection()
   at System.Windows.Media.FontFamily..cctor()
   --- End of inner exception stack trace ---
   at System.Windows.Media.FontFamily.LookupFontFamilyAndFace(CanonicalFontFamilyReference canonicalFamilyReference, FontStyle& style, FontWeight& weight, FontStretch& stretch)
   at System.Windows.Media.FontFamily.FindFirstFontFamilyAndFace(FontStyle& style, FontWeight& weight, FontStretch& stretch)
   at System.Windows.Media.FontFamily.get_FirstFontFamily()
   at System.Windows.Media.FontFamily.get_Baseline()
   at Eto.Wpf.Forms.ApplicationHandler.Initialize()
   at Eto.WidgetHandler`1.Eto.Widget.IHandler.Initialize()
   at Eto.Widget.Initialize()
   at Eto.Widget..ctor()
   at Eto.Forms.Application..ctor(InitHelper init)
   at Eto.Forms.Application..ctor(Platform platform)
   at Eto.Forms.Application..ctor(String platformType)
   at EtoNet5.Wpf.Program.Main(String[] args)
Faulting application name: EtoNet5.Wpf.exe, version: 1.0.0.0, time stamp: 0x6093090d
Faulting module name: KERNELBASE.dll, version: 10.0.19041.1110, time stamp: 0x4809adf2
Exception code: 0xe0434352
Fault offset: 0x0000000000034ed9
Faulting process id: 0x1e00
Faulting application start time: 0x01d77c1550dede3d
Faulting application path: D:\EtoNet5\EtoNet5\EtoNet5.Wpf\bin\Release\net5.0-windows7.0\publish\EtoNet5.Wpf.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report Id: 0d139fa1-0c7e-4cd7-9e94-b33223636701
Faulting package full name: 
Faulting package-relative application ID: 
Fault bucket 2235619698420955671, type 4
Event Name: APPCRASH
Response: Not available
Cab Id: 0

Problem signature:
P1: EtoNet5.Wpf.exe
P2: 1.0.0.0
P3: 6093090d
P4: KERNELBASE.dll
P5: 10.0.19041.1110
P6: 4809adf2
P7: e0434352
P8: 0000000000034ed9
P9: 
P10: 

Attached files:
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER31B2.tmp.dmp
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER3211.tmp.WERInternalMetadata.xml
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER3231.tmp.xml
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER3231.tmp.csv
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER3251.tmp.txt

These files may be available here:
\\?\C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppCrash_EtoNet5.Wpf.exe_759d8391deaf2747cf52153e56b6c84122d7b26a_00cf95e2_2b639303-c503-4108-976f-5f838e371ffe

Analysis symbol: 
Rechecking for solution: 0
Report Id: 0d139fa1-0c7e-4cd7-9e94-b33223636701
Report Status: 268435456
Hashed bucket: 9c7282c18f433202bf068445593f3a17
Cab Guid: 0

The publish build works as expected but for:

--warnaserror- --warnaserror ";NU1605"

Let me know if you want anything else.

By the way, the Linux Gkt project only produces the following in the Publish folder:

EtoNet5.Gtk
EtoNet5.pdb
EtoNet5.Gtk.pdb
cwensley commented 3 years ago

Yes, this is a problem with WPF itself. It does not support trimming or single file in .NET 5. I have hopes that it'll work with .NET 6.

LaraSQP commented 3 years ago

Closing the issue, then.