dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.24k stars 1.76k forks source link

Creating an unpackaged Windows Maui app STILL does not work. #23858

Open mobynet1 opened 3 months ago

mobynet1 commented 3 months ago

Description

I thought I had read that the issue with fonts and icons not showing up when doing an unpackaged Windows Maui app was fixed. I am finding it is not fixed. I just followed the instructions on how to create an unpackaged release and it still does not work. This is a GLARING deficiency in the way Maui applications are published.

I get that Xamarin apps were probably mostly going to be delivered via the App Store. But, I am positing that a majority of desktops apps will not now or ever be distributed through the app store. As a developer, I resent the fact that I have to contort myself into getting something I can deliver to my customers easily. Having to manually edit the project file and issue dotnet commands from the command line just to get an unpackaged deliverable is unacceptable. If the Maui team had looked at doing the initial release as not only a mobile-first (Xamarin port) but also how to support ALL that WPF did, you would have a happier developer community. I have, since WinForms days, distributed my application via a WiX-generated MSI. I have too many things in my WiX bundle to bundle up in an MSIX bundle.

I have found on multiple occasions that when the project file is modified manually something happens and suddenly the code-behind files are not bound to their xaml pages. I have had to rebuild from scratch the entire solution to get around this annoying bug. I reported this issue, #23805, the other day and that is not what this issue is about, but it is related.

When I run an unpackaged build from the publish folder, the icons do not show up as they should. Again, I thought this was fixed, but it is not.

Here is the app when launched from Visual Studio:

Screenshot 2024-07-26 094215

Here is the same app when launched from the publish folder:

Screenshot 2024-07-26 094346

How are we supposed to be successful with our products if you, Microsoft/Maui Team, are not successful with your product? If I am missing something, please enlighten me...

Steps to Reproduce

Just create an unpackaged app with a mixture of png, font awsome icons, and svg files. You will instantly see!

Link to public reproduction project repository

No response

Version with bug

8.0.70 SR7

Is this a regression from previous behavior?

It has NEVER worked...

Last version that worked well

8.0.3 GA

Affected platforms

Windows

Affected platform versions

net8.0-windows10.0.19041.0

Did you find any workaround?

Yes. Create a packaged app, extract using unzip the MSIX file and get the components to include in my WiX installer. What a PITA!

Relevant log output

I see a raft full of errors similar to these (formatted with NLog)

----------------------------------
2024-07-26 09:21:46.0588 WARN  
  Call site:         FontImageSourceService.GetImageSourceAsync
  Method name:       Microsoft.Maui.FontImageSourceService.GetImageSourceAsync
  Line:              0
  Exception Type:    System.InvalidOperationException
  Exception Message: This operation is not supported for a relative URI.
  Stack Trace:       at System.Uri.get_AbsolutePath()
   at Microsoft.Maui.FontImageSourceService.GetFontSource(IFontImageSource imageSource)
   at Microsoft.Maui.FontImageSourceService.RenderImageSource(IFontImageSource imageSource, Single scale)
   at Microsoft.Maui.FontImageSourceService.GetImageSourceAsync(IFontImageSource imageSource, Single scale, CancellationToken cancellationToken)
  Additional Info:   Unable to generate font image ''.
----------------------------------

and

----------------------------------
2024-07-26 09:21:46.0817 ERROR 
  Call site:         FontImageSourceService.GetImageSourceAsync
  Method name:       Microsoft.Maui.FontImageSourceService.GetImageSourceAsync
  Line:              0
  Exception Type:    System.InvalidOperationException
  Exception Message: This operation is not supported for a relative URI.
  Stack Trace:       at System.Uri.get_AbsolutePath()
   at Microsoft.Maui.FontImageSourceService.GetFontSource(IFontImageSource imageSource)
   at Microsoft.Maui.FontImageSourceService.RenderImageSource(IFontImageSource imageSource, Single scale)
   at Microsoft.Maui.FontImageSourceService.GetImageSourceAsync(IFontImageSource imageSource, Single scale, CancellationToken cancellationToken)
  Additional Info:   An error occurred
----------------------------------
github-actions[bot] commented 3 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

MartyIX commented 3 months ago

Kind of hesitate to suggest it but IMHO it should be fairly easy for you to debug this yourself using MAUI's sandbox project:

https://github.com/dotnet/maui/pull/22646/files#diff-e382f4e10273b69c6d437c0905004604ed150e9c4b359f70c6501169567907b8 might be relevant here.

mobynet1 commented 3 months ago

@MartyIX you probably should have hesitated... This is a Maui and/or Telerik internals issue. I'm not going to debug their code...

MartyIX commented 3 months ago

Let's wait then :)

hlbmallo commented 3 months ago

Having a similar problem here that is blocking me from releasing the next version of my app, so I feel the frustration. Despite building, packing and bundling the different versions of my app for Windows using the latest stable version of .NET MAUI, the fonts and, crucially, the bundled images and icons, regardless of their Build Action, don't appear when the app is released and installed via a Test Flight through the Store. Hope a fix can be released soon.

mobynet1 commented 3 months ago

I finally made the decision to pull the plug on Maui. I sent the Maui team's product manager a direct email asking for help, even if I paid for it, and after two weeks, still no response. There are issues that I raised over a year ago that are still not resolved, and I can't continue to wait. I have transitioned to the Uno Platform in less than a week and am very pleased not only with the quality of the framework itself, but also by the rapid response I get from their development team. I have raised several issues that they addressed and will be released in their next release. That is the response we all should expect.

MagicAndre1981 commented 3 months ago

23787 was just merged which enables unpackaged apps by default for .net9 when you create new projects. So I assume unpackaged apps work since .net9

mattleibow commented 2 months ago

Unpackaged should be working. I tried now with the latest stable VS and .NET MAUI 8.0.72 and I cannot reproduce the issue.

MauiApp9.zip

  1. Ran dotnet publish -f net8.0-windows10.0.19041.0
  2. Zipped up the publish folder bin\Release\net8.0-windows10.0.19041.0\win10-x64\publish
  3. Deleted the whole source project
  4. Extracted the published up to a new location
  5. Ran the app from the .exe file in Windows Explorer

This was the outcome. Notice the 3 calendar icons. On is a font in a label, one is an image with the font image source and the other is a button with a font image source:

image

mattleibow commented 2 months ago

Maybe there is an issue with the font filename, the alias provided or something. If this is happening to you (or anyone) then is it possible to attach a project where this is failing. There is also mention of a release app published... Does it work in debug? How are you publishing? What is your full CLI command?

PureWeen commented 2 months ago

Can you also try on the latest version of MAUI?

mobynet1 commented 2 months ago

I don't have time to debug this issue any longer. I have decided to pull the plug on Maui and have switched entirely to the Uno Platform. I have complained about this issue for over a year and a half and it's time to move on.