Another Export Error

Tried to export TexCovGUi with 2022.5.0-103. But get the following error:

D:\tmp\tcg\src\VL.ImGui.vl\VL.ImGui.vl.csproj : warning NU1507: There are 4 package sources defined in your configuration. When using central package management, please map your package sources with package source mapping (https://aka.ms/nuget-package-source-mapping) or specify a single package source. [D:\tmp\tcg\src\TexConvGui\TexConvGui.csproj]
D:\tmp\tcg\src\VL.Lang.vl\VL.Lang.vl.csproj : warning NU1507: There are 4 package sources defined in your configuration. When using central package management, please map your package sources with package source mapping (https://aka.ms/nuget-package-source-mapping) or specify a single package source. [D:\tmp\tcg\src\TexConvGui\TexConvGui.csproj]
D:\tmp\tcg\src\VL.WinFormsUtils.vl\VL.WinFormsUtils.vl.csproj : warning NU1507: There are 4 package sources defined in your configuration. When using central package management, please map your package sources with package source mapping (https://aka.ms/nuget-package-source-mapping) or specify a single package source. [D:\tmp\tcg\src\TexConvGui\TexConvGui.csproj]
D:\tmp\tcg\src\VL.CoreLib.vl\VL.CoreLib.vl.csproj : warning NU1507: There are 4 package sources defined in your configuration. When using central package management, please map your package sources with package source mapping (https://aka.ms/nuget-package-source-mapping) or specify a single package source. [D:\tmp\tcg\src\TexConvGui\TexConvGui.csproj]
D:\tmp\tcg\src\VL.Skia.vl\VL.Skia.vl.csproj : warning NU1507: There are 4 package sources defined in your configuration. When using central package management, please map your package sources with package source mapping (https://aka.ms/nuget-package-source-mapping) or specify a single package source. [D:\tmp\tcg\src\TexConvGui\TexConvGui.csproj]
D:\tmp\tcg\src\VL.CoreLib.Windows.vl\VL.CoreLib.Windows.vl.csproj : warning NU1507: There are 4 package sources defined in your configuration. When using central package management, please map your package sources with package source mapping (https://aka.ms/nuget-package-source-mapping) or specify a single package source. [D:\tmp\tcg\src\TexConvGui\TexConvGui.csproj]
D:\tmp\tcg\src\TexConvGui\TexConvGui.csproj : warning NU1507: There are 4 package sources defined in your configuration. When using central package management, please map your package sources with package source mapping (https://aka.ms/nuget-package-source-mapping) or specify a single package source.
C:\Program Files\dotnet\sdk\6.0.300\NuGet.targets(130,5): error : Ambiguous project name 'TexConvGui'. [D:\tmp\tcg\src\TexConvGui\TexConvGui.csproj]

  at VL.Lang.Roslyn.Export.ProjectBuilder.BuildAsync(String projectFileOrSolution, Dictionary`2 properties, IProgress`1 progress, CancellationToken token)
  at VL.Lang.Roslyn.Export.ProjectBuilder.Build(Dictionary`2 properties, IProgress`1 progress, CancellationToken token)
  at VL.Lang.Roslyn.Export.SolutionBuilder.Build(IProgress`1 progress, CancellationToken token)
  at VL.Lang.Roslyn.Export.SolutionBuilder.Export(IProgress`1 progress, CancellationToken token, AssetManagement assetManagement)
  at VL.Lang.Roslyn.Export.RoslynAppExporter.Export(ExportOptions options, IProgress`1 progress, CancellationToken token, AssetManagement assetManagement)
  at VL.HDE.Forms.AppExporterForm.ExportButton_Click(Object sender, EventArgs e)

I have a helper project / dll that is also called TexconvGui that was causing the problem. Even though the VL.Imgui.vl document references the compiled dll, the solution created by the exporter is referencing the project.

<PlatformDependency Id="TVMtxbJD83mQZ2iXTsWwT4" Location="./lib/net6.0-windows/TexConvGui.dll" />

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.0.0
MinimumVisualStudioVersion = 17.2.0.0
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TexConvGui", "TexConvGui\TexConvGui.csproj", "1B28547C-C900-EBB0-FA81-40889DFF8580"
EndProject
[...]
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TexConvGui", "..\..\_dev\texconvgui\src\TexConvGui.csproj", "84F5657B-D537-9FA1-2BAC-6803F03E0890"
EndProject
Global

After renaming the helper project (which imho shouldn’t be necessary) the exporter runs successfully but the exported executetable still crashes at start up.

************** Exception Text **************
System.TypeInitializationException: The type initializer for 'VL.Skia.Egl.NativeEgl' threw an exception.
 ---> System.InvalidOperationException: Could not load native library libEGL using CPU architecture x64.
   at Stride.Core.NativeLibraryHelper.PreloadLibrary(String libraryName, Type owner) in C:\BuildAgent\work\c2853678a9eec380\sources\core\Stride.Core\Native\NativeLibraryHelper.cs:line 137
   at VL.Skia.Egl.NativeEgl..cctor()
   --- End of inner exception stack trace ---
   at VL.Skia.Egl.EglDisplay.<GetPlatformDefault>g__TryCreate|2_0(Int32[] displayAttributes)
   at VL.Skia.Egl.EglDisplay.GetPlatformDefault()
   at VL.Skia.RenderContext.ForCurrentThread()
   at VL.Skia.SkiaGLControl.OnHandleCreated(EventArgs e)
   at System.Windows.Forms.Control.WmCreate(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.UserControl.WndProc(Message& m)
   at VL.Skia.SkiaGLControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)

@Elias

An other export-related question: Are all the dlls included in the export really necessary? The result is now 670 files and nearly 250 MB in size in comparison the “old” TexConvGui is about 4 MB.

Thanks for the reports. Will have a look at it soon. Regarding the size, indeed, it’s too bloated. One part of the problem is us - our VL.CoreLib wrongly depends on VL.Lang which pulls in a lot of packages. Was hoping to address this in 2022.5. The other part is that we didn’t really test / explore yet are the different deployment options in .NET 6 - apps can be deployed framework dependent or not. Meaning the target machine either needs to have the .NET 6 runtime installed or not (see Application publishing - .NET | Microsoft Docs).

The system referencing the project file while you didn’t say so - will be fixed in upcoming. So the project will no longer be included in the exported solution. But even then, the naming conflict is harsh. Just tried it myself, and one runs into all sorts of type load errors if those assemblies have the same name. So I’d strongly recommend renaming that little helper project.

Sadly I didn’t get the last crash you’re reporting. Will need to try again with a release build on a different machine maybe.

Thanks and will do.

Whe running the export from Visual Studio I get the following:

System.TypeInitializationException: 'The type initializer for 'VL.Skia.Egl.NativeEgl' threw an exception.

Inner Exception
InvalidOperationException: Could not load native library libEGL using CPU architecture x64.

Tried on my desktop with 2022.5.0-108. Here the exported executble crashes hard (no exception dialog).
From Windows Event Viewer:

Faulting application name: TexConvGui.exe, version: 1.0.0.0, time stamp: 0x6283e0e1
Faulting module name: coreclr.dll, version: 6.0.622.26707, time stamp: 0x6283d982
Exception code: 0xc0000005
Fault offset: 0x00000000001d1fdd
Faulting process ID: 0xea8
Faulting application start time: 0x01d88f8c474cbb73
Faulting application path: D:\Tmp\tcg\TexConvGui\TexConvGui.exe
Faulting module path: D:\Tmp\tcg\TexConvGui\coreclr.dll
Report ID: 10b61eda-43e2-4225-9ce9-20df70b47924
Faulting package full name: 
Faulting package-relative application ID:

When starting the export from Visual Studio:
System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'

Upcoming build should address most of the issues raised here. To do the export it will now use dotnet publish -c Release --self-contained false which in turn requires the .NET 6 runtime to be installed on the target machine (which is reasonable). We can probably add a switch later to the export dialog controlling that flag.

Also the refs folder is no more (it’s only needed by our editor) and also the system will no longer need to create a dummy VL session instance (which already caused issues in the past with config files) and should therefor improve startup time of the exported app.

Future steps:

  • Get rid of *.pdb and *.xml files in output - for now you can safely delete them
  • Get rid of VL.CoreLib → VL.Lang dependency, which in turn should get rid of all those Microsoft.Build.*, Microsoft.CodeAnalysis.* and NuGet.* assemblies (side note: the Microsoft.Build will probably come back in as long as VL.Stride.Windows still has a dependency on it)
  • Review the PublishTrimmed, PublishSingleFile, PublishReadyToRun options - not sure they work as advertised, having concerns regarding any APIs using reflection code (which there’re usually alot)
4 Likes

Those *.pdb and *.xml files are now excluded from the output folder in upcoming build. Super simple app is now down to 43 MB. Without the before mentioned dependency to VL.Lang it could go down further by ~20MB.

5 Likes

Thanks. Current export of TexConvGui is ~190 MB. By manually removing some I got it down to about 110 MB without breaking things.

Did you delete everything from previous exports ?

Yes

Idk if it’s helpful in any way but here are two lists of the files (all / removed):
Files.zip (3.2 KB)

Hm ok, that’s strange, why is Stride part of your output and not mine? It’s not referenced at all from what I understand.

Mh strange, exported into a new folder (and enabled Clean Output). Using 2022.5.0-0116 btw.
I’ll try again.

Did it a second time and now also two Stride dlls sneaked themselfs in… something is not right. Will need to investigate.

Now it’s also only 114 files, but I am pretty sure I did a clean export before…
image

Ok got it. Fix in upcoming build, thanks for testing!

Gave it another go (with 2022.5.0-0118) and I still got a lot of dlls in the export that appear to be unnecessary.
Some of the stuff clearly doesn’t belong there, for example Ookii.Dialogs.WinForms.dll is from a nuget that I have on my computer but isn’t referenced in the vl file.

Was able to delete 59 more files manually, shaving off another 17 MB.

A list of the deleted stuff:
Deleted.zip (740 Bytes)

Yes, see my 2nd point above in future steps.