unoplatform / uno.extensions

Libraries to ease common developer tasks associated with building multi-platform mobile, desktop and web applications using Uno Platform or WinAppSDK.
https://platform.uno/
Other
69 stars 41 forks source link

[Core] WinAppSdk - InvalidOperationException Uno.Extensions.Toolkit.ScopedThemeService: Error: GetSavedTheme - [ThemeService.GetSavedTheme()] - Error while reading stored theme. #2114

Open lindexi opened 5 months ago

lindexi commented 5 months ago

Current behavior

Throw the System.InvalidOperationException when application startup.

The more info:

Uno.Extensions.Toolkit.ScopedThemeService: Error: GetSavedTheme - [ThemeService.GetSavedTheme()] - Error while reading stored theme.

System.InvalidOperationException: Operation is not valid due to the current state of the object.
   at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|39_0(Int32 hr)
   at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr)
   at ABI.Windows.Storage.IApplicationDataStaticsMethods.get_Current(IObjectReference _obj)
   at Windows.Storage.ApplicationData.get_Current()
   at Uno.Extensions.Toolkit.ThemeService.GetSavedTheme()

Reference: https://github.com/unoplatform/uno/issues/12578

Expected behavior

Work well?

How to reproduce it (as minimally and precisely as possible)

  1. Create the new and default UNO project
  2. Switch the WinUI project
  3. Build And Run

You can find my project code here: https://github.com/dotnet-campus/dotnetCampus.FileDownloader/tree/b033d24170d24b2d6ef491bdbd75139ba05b1c74/src/UnoFileDownloader

Workaround

No response

Works on UWP/WinUI

None

Environment

No response

NuGet package version(s)

Directory.Packages.props:

<Project ToolsVersion="15.0">
  <ItemGroup>
    <PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.0-rc.2.23479.6" />
    <PackageVersion Include="coverlet.collector" Version="6.0.0" />
    <PackageVersion Include="FluentAssertions" Version="6.12.0" />
    <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
    <PackageVersion Include="NUnit" Version="3.13.3" />
    <PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
    <PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
    <PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
    <PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.4.231008000" />
    <PackageVersion Include="SkiaSharp.Skottie" Version="2.88.6" />
    <PackageVersion Include="SkiaSharp.Views.Uno.WinUI" Version="2.88.6" />
    <PackageVersion Include="Uno.Core.Extensions.Logging.Singleton" Version="4.0.1" />
    <PackageVersion Include="Uno.Extensions.Core.WinUI" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Configuration" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Hosting" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Hosting.WinUI" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Http" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Http.WinUI" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Http.Refit" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Localization" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Localization.WinUI" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Logging.OSLog" Version="1.7.0" />
    <PackageVersion Include="Uno.Extensions.Logging.WinUI" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Navigation" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Navigation.WinUI" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Navigation.Toolkit.WinUI" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Reactive" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Reactive.WinUI" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Serialization" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Serialization.Http" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Serialization.Refit" Version="3.0.11" />
    <PackageVersion Include="Uno.Material.WinUI" Version="4.0.6" />
    <PackageVersion Include="Uno.Dsp.Tasks" Version="1.2.8" />
    <PackageVersion Include="Uno.Toolkit.WinUI" Version="5.0.19" />
    <PackageVersion Include="Uno.Toolkit.WinUI.Material" Version="5.0.19" />
    <PackageVersion Include="Uno.Resizetizer" Version="1.2.1" />
    <PackageVersion Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="5.0.64" />
    <PackageVersion Include="Uno.UniversalImageLoader" Version="1.9.36" />
    <PackageVersion Include="Uno.WinUI" Version="5.0.64" />
    <PackageVersion Include="Uno.WinUI.Lottie" Version="5.0.64" />
    <PackageVersion Include="Uno.WinUI.DevServer" Version="5.0.64" />
    <PackageVersion Include="Uno.WinUI.Skia.Gtk" Version="5.0.64" />
    <PackageVersion Include="Uno.WinUI.Skia.Wpf" Version="5.0.64" />
    <PackageVersion Include="Xamarin.Google.Android.Material" Version="1.10.0.1" />
    <PackageVersion Include="Uno.UITest.Helpers" Version="1.1.0-dev.70" />
    <PackageVersion Include="Xamarin.UITest" Version="4.3.0" />
  </ItemGroup>
</Project>

Affected platforms

Windows

IDE

Visual Studio 2022

IDE version

VisualStudio 2022 17.7.6

Relevant plugins

No response

Anything else we need to know?

No response

Youssef1313 commented 5 months ago

This doesn't look related to core Uno. I'll move to uno.extensions repo

lindexi commented 5 months ago

Thank you @Youssef1313

Guidemarcus commented 4 months ago

@lindexi any update on this issue? Do you know of any possible workaround?

Guidemarcus commented 4 months ago

After some research, it seems to happen when we select something else than None on the Authentication step of the app creation.

nickrandolph commented 1 week ago

I think this should be resolved now. I'm assuming this was happening when running WinAppSdk target as unpackaged?

lindexi commented 1 week ago

@nickrandolph Thank you and how can I do to solve it?