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

Default MAUI project cannot be launched for Windows #6111

Closed
holecekp opened this issue Apr 14, 2022 · 8 comments
Closed

Default MAUI project cannot be launched for Windows #6111

holecekp opened this issue Apr 14, 2022 · 8 comments
Labels
area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging platform/windows 🪟 s/needs-attention Issue has more information and needs another look s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@holecekp
Copy link

Description

I have downloaded Visual Studio 17.2.0 Preview 3.0 and created a new MAUI application using the default template in VS. I did not modified anything. I have just pressed F5. However, the solution cannot be compiled for Windows. Several errors are shown:

maui windows errors

I have switched the target to Android, launched the app and it can be compiled and it runs fine.

Then, I have switched to Windows again. This time the app can be compiled but it crashes right after the start. The following error is shown:

System.DllNotFoundException: Unable to load DLL 'Microsoft.ui.xaml.dll' or one of its dependencies: Uvedený modul nebyl nalezen. (0x8007007E)

maui windows crash

Steps to Reproduce

  1. Create new MAUI application
  2. Make sure that "Windows machine" is selected as the target.
  3. Try to run the app by pressing F5.

Version with bug

Release Candidate 1 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows 10 (21H2, build 19044.1645)

Did you find any workaround?

No

Relevant log output

'MauiTest.exe' (CoreCLR: DefaultDomain): Loaded 'D:\dotNET\MauiTest\MauiTest\bin\Debug\net6.0-windows10.0.19041\win10-x64\AppX\System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiTest.exe' (CoreCLR: clrhost): Loaded 'D:\dotNET\MauiTest\MauiTest\bin\Debug\net6.0-windows10.0.19041\win10-x64\AppX\MauiTest.dll'. Symbols loaded.
'MauiTest.exe' (CoreCLR: clrhost): Loaded 'D:\dotNET\MauiTest\MauiTest\bin\Debug\net6.0-windows10.0.19041\win10-x64\AppX\System.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiTest.exe' (CoreCLR: clrhost): Loaded 'D:\dotNET\MauiTest\MauiTest\bin\Debug\net6.0-windows10.0.19041\win10-x64\AppX\WinRT.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiTest.exe' (CoreCLR: clrhost): Loaded 'D:\dotNET\MauiTest\MauiTest\bin\Debug\net6.0-windows10.0.19041\win10-x64\AppX\System.Runtime.InteropServices.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiTest.exe' (CoreCLR: clrhost): Loaded 'D:\dotNET\MauiTest\MauiTest\bin\Debug\net6.0-windows10.0.19041\win10-x64\AppX\System.Collections.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiTest.exe' (CoreCLR: clrhost): Loaded 'D:\dotNET\MauiTest\MauiTest\bin\Debug\net6.0-windows10.0.19041\win10-x64\AppX\System.Collections.Concurrent.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiTest.exe' (CoreCLR: clrhost): Loaded 'D:\dotNET\MauiTest\MauiTest\bin\Debug\net6.0-windows10.0.19041\win10-x64\AppX\System.Threading.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiTest.exe' (CoreCLR: clrhost): Loaded 'D:\dotNET\MauiTest\MauiTest\bin\Debug\net6.0-windows10.0.19041\win10-x64\AppX\Microsoft.WinUI.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
An unhandled exception of type 'System.DllNotFoundException' occurred in MauiTest.dll
Unable to load DLL 'Microsoft.ui.xaml.dll' or one of its dependencies: Uvedený modul nebyl nalezen. (0x8007007E)

The program '[7444] MauiTest.exe' has exited with code 4294967295 (0xffffffff).
@holecekp holecekp added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Apr 14, 2022
@Eilon Eilon added platform/windows 🪟 area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging labels Apr 14, 2022
@v-longmin v-longmin added s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Apr 15, 2022
@v-longmin
Copy link

verified not repro on VS 17.2.0 preview 2.1 [32317.152] with MAUI project.

@drasticactions
Copy link
Contributor

image

The first error here is that Visual Studio shows every target framework for this page, even though it should only show Windows. That's why you see the errors. I believe that's a Roslyn bug that should be fixed in 17.3 Preview 1. It's irrelevant to your issue here. The thing is, it should still compile though, since it's not actually a build error.

Your issue is that the WinUI DLL is not being added as output to your project, so it's blowing up. I would see if you can try building a straight WinUI app and see if that works, or maybe try adding a direct reference to the WindowsAppSDK (https://www.nuget.org/packages/Microsoft.WindowsAppSDK)?

@mvartuc
Copy link

mvartuc commented Apr 20, 2022

I'm having the same issue, so far nothing has worked...

@Redth Redth added the s/needs-repro Attach a solution or code which reproduces the issue label Apr 20, 2022
@ghost
Copy link

ghost commented Apr 20, 2022

Hi @holecekp. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Apr 20, 2022
@holecekp
Copy link
Author

holecekp commented Apr 20, 2022

I have found some time and uploaded a repro project to Github:
https://github.com/holecekp/mauiemptyapp.App

The repro project is just a blank MAUI app created by Visual Studio using the default template. So this is what everyone gets when selecting New > MAUI APP (preview) in VS 2022 preview 3. I did not make any changes! All this code has been generated by Visual Studio.

Select "Windows Machine" as a target and launch it. It crashes immediately.

@jfversluis
Copy link
Member

Got your exact code, ran it and it works fine. It must be something in your setup.

Could you maybe check if you have the C++ Redistributable package installed? And if not, install that?

And as @drasticactions suggested, check if a WinUI app works without .NET MAUI. Together with that you might want to check if the WinUI workload was installed. One of the prerequisites isn't right.

Closing this for now as being an official bug on our side, feel free to let us know what you find.

Thanks!

@holecekp
Copy link
Author

holecekp commented Apr 21, 2022

The problem was in the version of Visual C++ Redistributable. I had version 2017 installed on my computer and the MAUI app crashes with it. As soon as I have installed version "2015-2022" the problem disappeared and MAUI app runs fine on Windows. Thank you for your help.

So this is a problem of the preview version of Visual Studio. The correct behavior would be that all dependencies (including Visual C++ Redistributable 2015-2022) should be installed automatically when MAUI workload is installed, or the VS should at least warn the user that an important component is missing.

@drasticactions
Copy link
Contributor

My guess is that you don't have the WinUI workload installed either, which probably contains that dependency, where MAUI itself does not. I would file that to VS then https://developercommunity.visualstudio.com/home

@ghost ghost locked as resolved and limited conversation to collaborators May 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging platform/windows 🪟 s/needs-attention Issue has more information and needs another look s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants