The system tray in WeatherTwentyOne is craching when publishing as exe

Dani_S 3,786 Reputation points
2022-12-14T07:35:31.233+00:00

Hi.

Steps to Reproduce

  1. Create Maui app
  2. Publish from command line using:
    dotnet publish -f net6.0-windows10.0.19041.0 -c Release /p:AppxPackageSigningEnabled=true /p:PackageCertificateThumbprint="c01ba45666762f3615cf6813aeb4dc4b1919541d"
    The app https://github.com/davidortinau/WeatherTwentyOne
  3. The app is crashing after a while.
    On this code:
    public class NotificationService : INotificationService
    {
    public void ShowNotification(string title, string body)
    {
    new ToastContentBuilder()
    .AddToastActivationInfo(null, ToastActivationType.Foreground)
    .AddAppLogoOverride(new Uri("ms-appx:///Assets/dotnet_bot.png"))
    .AddText(title, hintStyle: AdaptiveTextStyle.Header)
    .AddText(body, hintStyle: AdaptiveTextStyle.Body)
    .Show();
    }
    }
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,487 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Rob Caplan - MSFT 5,452 Reputation points Microsoft Employee
    2022-12-16T02:27:59.903+00:00

    For help with https://github.com/davidortinau/WeatherTwentyOne please post in that github. The ToastContentBuilder is part of the Windows Community Toolkit from https://github.com/CommunityToolkit/WindowsCommunityToolkit

    An error is here: .AddAppLogoOverride(new Uri("ms-appx:///Assets/dotnet_bot.png"))
    The ms-appx: URI refers to assets in your app package and isn't meaningful in your unpackaged application.

    You should be able to use a file URI instead of an ms-appx uri.

    See the documentation for ToastContentBuilder.AddAppLogoOverride for details.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.