dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.28k stars 1.76k forks source link

[Bug] Using Maui Essentials in a non-MAUI app throws an error on launch #1779

Closed egvijayanand closed 2 years ago

egvijayanand commented 3 years ago

Description

Using Maui Essentials in a non-MAUI app throws an error on launch though the build succeeded

Steps to Reproduce

  1. Create a new WPF project (non-MAUI) and set the target framework as net6.0-windows10.0.18362 (Windows 10 1903)
  2. Configure Maui Essentials with <UseMauiEssentials>true</UseMauiEssentials> in the project file
  3. Use the Essentials Connectivity feature in the main window
  4. Build and run the project, displays an error dialog on launch as in below screenshot Maui-Essentials

Note: NuGet package source is configured with Maui Preview repo (https://aka.ms/maui-preview/index.json)

Expected Behavior

The application is expected to run without any issues.

Actual Behavior

Displays a dialog to download the .NET since Microsoft.Maui.Essentials could not be found. The .NET 6 Preview 6 SDK itself is installed on the machine.

Basic Information

Screenshots

Reproduction Link

Workaround

Daniellled commented 3 years ago

I am also seeing the same type of error when running unit test.

Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Testhost process exited with error: It was not possible to find any compatible framework version The framework 'Microsoft.Maui.Extensions', version '6.0.100-preview.6.1003+sha.5c159aabf-azdo.4977641' was not found.

  • No frameworks were found. You can resolve the problem by installing the specified framework and/or SDK. The specified framework can be found at:
  • https://aka.ms/dotnet-core-applaunch?framework=Microsoft.Maui.Extensions&framework_version=6.0.100-preview.6.1003+sha.5c159aabf-azdo.4977641&arch=x64&rid=win10-x64 . Please check the diagnostic logs for more information. at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.ThrowOnTestHostExited(Boolean testHostExited) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources, String runSettings) at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyDiscoveryManager.DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEventsHandler2 eventHandler)

Except it is related to the Microsoft.Maui.Extensions dll.

Like you it worked on Preview 5 and now with the new WorkLoad stuff it no longer works. I am able to run MAUI applications fine.

egvijayanand commented 3 years ago

Yes, the issue is only with a non-MAUI app in .NET 6 Preview 6. MAUI app works fine.

egvijayanand commented 3 years ago

Issue still persists in .NET 6 Preview 7.

Maui-Essentials-1
jsuarezruiz commented 3 years ago

There is not an WPF target in Essentials: https://github.com/dotnet/maui/blob/main/src/Essentials/src/Essentials-net6.csproj#L3

We are going to review this scenario.

egvijayanand commented 3 years ago

There is not an WPF target in Essentials: https://github.com/dotnet/maui/blob/main/src/Essentials/src/Essentials-net6.csproj#L3

We are going to review this scenario.

Same is the case with a WinForms application too. Kindly include that scenario as well.

Eilon commented 2 years ago

@jsuarezruiz / @Redth / @davidortinau - is MAUI Essentials support for WPF something we can postpone to a later release?

shimingsg commented 2 years ago

verified repro with VS 17.2.0 Preview 2.0 [32302.528.main]

mattleibow commented 2 years ago

This is a duplicate of #4779

egvijayanand commented 2 years ago

Hi @mattleibow,

I'm not sure whether you've gone through the issue details or conservation pertaining to that.

@jsuarezruiz / @Redth / @davidortinau - is MAUI Essentials support for WPF something we can postpone to a later release?

But it's definitely not a duplicate of #4779, that is about referencing the Maui Essentials in a Razor Class Library (RCL) whereas this is about an issue that occurs during the launch of the application that uses Maui Essentials in other Windows Client applications like WinForms / WPF.

The issue is still simulating with the attached project, hence kindly reopen this issue.

MyApp.zip

Regards, Vijay Anand E G

egvijayanand commented 2 years ago

image

This is the error that is still showing on launching the application.

Redth commented 2 years ago

Essentials is not currently supported and there are no plans at this time to add support in WPF