microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.35k stars 677 forks source link

Bug title #10043

Open git102347501 opened 2 weeks ago

git102347501 commented 2 weeks ago

Describe the bug

My Winui3 program runs smoothly on VS2022, whether debugging or deploying it locally. However, when I run and publish it to the store, compile and package it as MSIX, install the application, and open it, there is no response

Steps to reproduce the bug

  1. Right click menu, publish and deploy, create application package

  2. Choose Microsoft Store as the HiToDo I offer

  3. Select system, x64, Release (x64)

  4. After clicking create, the packaging was successful

  5. Run the Windows test program and pass the test

  6. Click on HiToDo_1.0.3.0-x64.msix to install the application image

  7. After clicking on the application icon, there is no response

Expected behavior

The program can run normally

Screenshots

image image

NuGet package version

WinUI 3 - Windows App SDK 1.6.1: 1.6.240923002

Windows version

Windows 11 (22H2): Build 22621

Additional context

This is My Obj.csproj Config:

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
    <WindowsSdkPackageVersion>10.0.19041.38</WindowsSdkPackageVersion>
    <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
    <RootNamespace>HiToDo</RootNamespace>
    <ApplicationManifest>app.manifest</ApplicationManifest>
    <Platforms>x86;x64;ARM64</Platforms>
    <RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &gt;= 8">win-x86;win-x64;win-arm64</RuntimeIdentifiers>
    <RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
    <PublishProfile>win-$(Platform).pubxml</PublishProfile>
    <UseWinUI>true</UseWinUI>
    <EnableMsixTooling>true</EnableMsixTooling>
    <ApplicationIcon>Assets\WindowIcon.ico</ApplicationIcon>
    <PackageIcon>128x128.png</PackageIcon>
    <PackageReadmeFile>README.md</PackageReadmeFile>
    <GenerateTemporaryStoreCertificate>True</GenerateTemporaryStoreCertificate>
    <GenerateAppInstallerFile>False</GenerateAppInstallerFile>
    <AppxPackageSigningEnabled>False</AppxPackageSigningEnabled>
    <AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
    <AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
    <AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
    <GenerateTestArtifacts>True</GenerateTestArtifacts>
    <AppxBundle>Auto</AppxBundle>
    <AppxBundlePlatforms>x86|x64</AppxBundlePlatforms>
    <HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
    <DefaultLanguage>zh-CN</DefaultLanguage>
  </PropertyGroup>
git102347501 commented 2 weeks ago

I also tried right clicking on the solution and deploying it locally, and found the following pattern When I deploy to the local machine using Debug mode, the application runs normally When I deploy to the local machine using Release mode, the problem occurs and clicking on the application icon does not have any response This Is My System Log:

Application: HiToDo.exe CoreCLR Version: 8.0.824.36612 .NET Version: 8.0.8 Description: The process was terminated due to an unhandled exception. Exception Info: System.Runtime.InteropServices.COMException (0x80040154): 没有注册类 (0x80040154 (REGDB_E_CLASSNOTREG)) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode) at WinRT.ActivationFactory.Get(String typeName, Guid iid) at Microsoft.UI.Xaml.Application.get__objRef_global__Microsoft_UI_Xaml_IApplicationStatics() at Microsoft.UI.Xaml.Application.Start(ApplicationInitializationCallback callback) at HiToDo.Program.Main(String[] args) in F:\Conch\HiToDo\obj\x64\Release\net8.0-windows10.0.19041.0\win-x64\App.g.i.cs:line 26

Incorrect application name: HiToDo.exe, version: 1.0.0.0, timestamp: 0x66960000 Error module name: KERNELBASE.ll, version: 192.168.19041.4842, timestamp: 0xe6d00f33 Exception code: 0xc000027b Error offset: 0x0000000132f62 Error process ID: 0xf28 Error application startup time: 0x01db19900d641352 Wrong application path: C: \ Program Files \ Windows Apps \ 44894A8DA8CBA HiTodo_1.0.3.0_x64a7ye5g38962e4\HiToDo.exe Error module path: C: \ Windows \ System32 \ KERNELBASE.ll Report ID: 6d1762bb-55d9-419b-b014-188d18d5787b Error package full name: 44894A8DA8CBA HiTodo_1.0.3.0_x64a7ye5g38962e4 Wrong package relative to application ID: App

lhak commented 2 weeks ago

You might have PublishTrimmed enabled in your publish profile for release mode. I think this only works if you use the very latest .net 8 version (8.0.10) or if you have a reference to the cswinrt package added to your project.