Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WinUI3 application is failed to start from command line #9348

Closed
mimregit opened this issue Feb 19, 2024 · 3 comments
Closed

WinUI3 application is failed to start from command line #9348

mimregit opened this issue Feb 19, 2024 · 3 comments
Labels
bug Something isn't working needs-triage Issue needs to be triaged by the area owners

Comments

@mimregit
Copy link

Describe the bug

I created a sample application, there was nothing special, just do it with the wizard, named AppTest.
The only modification was to add the appExecutionAlias extension to the package manifest file:

<Extensions>
	<uap5:Extension
	  Category="windows.appExecutionAlias"
	  Executable="AppTest.exe"
	  EntryPoint="AppTest.App">
		<uap5:AppExecutionAlias>
			<uap5:ExecutionAlias Alias="AppTest.exe" />
		</uap5:AppExecutionAlias>
	</uap5:Extension>
</Extensions>

Started the app from the Visual Studio wroked well.
Launched a command prompt, and typed in: AppTest

Weird results are:

  1. The operating system starts 2 instances of the application, the first is suspended initially, the second runs, but turns into suspended mode in 3 seconds, then immediately closed.
  2. There is no other effect on the screen.
  3. There is a .NET Runtime error on the Event Viever, saying called a thread attached to an other thread:
    Application: AppTest.exe
    CoreCLR Version: 6.0.2724.6912
    .NET Version: 6.0.27
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.Runtime.InteropServices.COMException (0x8001010E): Az alkalmazás olyan objektumfelületet hívott, amely egy másik szálhoz volt rendelve.

The Application Object must initially be accessed from the multi-thread apartment.
at WinRT.ExceptionHelpers.g__Throw|39_0(Int32 hr)
at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr)
at ABI.Microsoft.UI.Xaml.IApplicationStaticsMethods.Start(IObjectReference _obj, ApplicationInitializationCallback callback)
at Microsoft.UI.Xaml.Application.Start(ApplicationInitializationCallback callback)
at AppTest.Program.Main(String[] args)

Please, Microsoft, this problem has a predecessor, and I found never a solution on any forum!

At this moment it is impossible to launch from command line any WinUI application, although it would be necessary.
How can we solve this problem?

Steps to reproduce the bug

  1. Create any WinUI app
  2. Modify package.manifest
  3. Run the app once
  4. Open a command line and try to launch

Expected behavior

No response

Screenshots

image image

NuGet package version

WinUI 3 - Windows App SDK 1.4.5: 1.4.240411001

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

@mimregit mimregit added the bug Something isn't working label Feb 19, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Feb 19, 2024
Copy link

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. Thank you!

Closed similar issues:

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

@lhak
Copy link

lhak commented Feb 19, 2024

I think you need to set your EntryPoint to "Windows.FullTrustApplication".

@mimregit
Copy link
Author

I think you need to set your EntryPoint to "Windows.FullTrustApplication".

That helps, thank you!!

@microsoft-github-policy-service microsoft-github-policy-service bot added needs-triage Issue needs to be triaged by the area owners and removed needs-triage Issue needs to be triaged by the area owners labels Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage Issue needs to be triaged by the area owners
Projects
None yet
Development

No branches or pull requests

2 participants