maui
maui copied to clipboard
Pipeline commands fail with a dependency on maui-tizen
Description
Trying to run unit tests on a blank Maui project fails because it needs the maui-tizen workload installed. I've removed all references to Tizen in the codebase yet there seems to be something in the project/tooling that requires it.
The app appears to work locally but that may be a difference in workloads installed/commands being run compared to CI.
Steps to Reproduce
- Create a blank MAUI app
- Create a unit test project for that app
- Pin the .NET version at .NET 6 using Global.json.
- Using an Azure DevOps pipeline, run dotnet test
Expected outcome: Pipeline runs the tests successfully
Actual outcome: The pipeline fails requiring the maui-tizen dependency to be installed
I've included the Azure DevOps .yml pipeline in the reproduction project.
Link to public reproduction project repository
https://github.com/BurkusCat/DotNetTestTizen
Version with bug
6.0.400
Last version that worked well
Unknown/Other
Affected platforms
iOS, Android, Windows, macOS
Affected platform versions
N/A
Did you find any workaround?
I imagine installing the tizen workload would work around the issue, but the core of the issue is that we don't want to do this, and we shouldn't have an unnecessary dependency.
Relevant log output
2022-11-23T12:49:19.6544450Z ##[section]Starting: dotnet test
2022-11-23T12:49:19.6560250Z ==============================================================================
2022-11-23T12:49:19.6560590Z Task : .NET Core
2022-11-23T12:49:19.6560940Z Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command
2022-11-23T12:49:19.6561300Z Version : 2.210.0
2022-11-23T12:49:19.6561510Z Author : Microsoft Corporation
2022-11-23T12:49:19.6562320Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
2022-11-23T12:49:19.6562770Z ==============================================================================
2022-11-23T12:49:20.7319420Z Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version.
2022-11-23T12:49:29.2949530Z [command]/Users/runner/hostedtoolcache/dotnet/dotnet test /Users/runner/work/1/s/DotNetTestTizen.UnitTests/DotNetTestTizen.UnitTests.csproj --logger trx --results-directory /Users/runner/work/_temp /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=/Users/runner/work/1/s/TestResults/Coverage/
2022-11-23T12:49:29.2950980Z
2022-11-23T12:49:29.2951280Z Welcome to .NET 6.0!
2022-11-23T12:49:29.2951980Z ---------------------
2022-11-23T12:49:29.2952300Z SDK Version: 6.0.402
2022-11-23T12:49:29.2952430Z
2022-11-23T12:49:29.2952800Z Telemetry
2022-11-23T12:49:29.2953110Z ---------
2022-11-23T12:49:29.2954120Z The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.
2022-11-23T12:49:29.2954740Z
2022-11-23T12:49:29.2955210Z Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry
2022-11-23T12:49:29.2955480Z
2022-11-23T12:49:29.2955780Z ----------------
2022-11-23T12:49:29.2956130Z Installed an ASP.NET Core HTTPS development certificate.
2022-11-23T12:49:29.2956750Z To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only).
2022-11-23T12:49:29.2957300Z Learn about HTTPS: https://aka.ms/dotnet-https
2022-11-23T12:49:29.2957700Z ----------------
2022-11-23T12:49:29.2958150Z Write your first app: https://aka.ms/dotnet-hello-world
2022-11-23T12:49:29.2958660Z Find out what's new: https://aka.ms/dotnet-whats-new
2022-11-23T12:49:29.2959170Z Explore documentation: https://aka.ms/dotnet-docs
2022-11-23T12:49:29.2959610Z Report issues and find source on GitHub: https://github.com/dotnet/core
2022-11-23T12:49:29.2960230Z Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
2022-11-23T12:49:29.2960880Z --------------------------------------------------------------------------------------
2022-11-23T12:49:29.2961340Z Determining projects to restore...
2022-11-23T12:49:29.2962500Z /Users/runner/hostedtoolcache/dotnet/sdk/6.0.402/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: maui-tizen [/Users/runner/work/1/s/DotNetTestTizen.UnitTests/DotNetTestTizen.UnitTests.csproj]
2022-11-23T12:49:29.2963940Z /Users/runner/hostedtoolcache/dotnet/sdk/6.0.402/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore [/Users/runner/work/1/s/DotNetTestTizen.UnitTests/DotNetTestTizen.UnitTests.csproj]
2022-11-23T12:49:29.3004080Z ##[error]Error: The process '/Users/runner/hostedtoolcache/dotnet/dotnet' failed with exit code 1
2022-11-23T12:49:29.6324350Z ##[warning]No test result files were found.
2022-11-23T12:49:29.6327620Z ##[warning].NET 5 has some compatibility issues with older Nuget versions(<=5.7), so if you are using an older Nuget version(and not dotnet cli) to restore, then the dotnet cli commands (e.g. dotnet build) which rely on such restored packages might fail. To mitigate such error, you can either: (1) - Use dotnet cli to restore, (2) - Use Nuget version 5.8 to restore, (3) - Use global.json using an older sdk version(<=3) to build
2022-11-23T12:49:29.6332140Z Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
2022-11-23T12:49:29.6335910Z ##[error]Dotnet command failed with non-zero exit code on the following projects : /Users/runner/work/1/s/DotNetTestTizen.UnitTests/DotNetTestTizen.UnitTests.csproj
2022-11-23T12:49:29.6344760Z ##[section]Finishing: dotnet test
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Despite the project having no reference to Tizen, this error is still thrown. To workaround the issue you can install the workloads you need to use before your build:
- task: Bash@3
displayName: Install .NET MAUI
inputs:
targetType: 'inline'
script: |
dotnet nuget locals all --clear
dotnet workload install maui --source https://aka.ms/dotnet6/nuget/index.json --source https://api.nuget.org/v3/index.json
dotnet workload install android ios maccatalyst macos maui --source https://aka.ms/dotnet6/nuget/index.json --source https://api.nuget.org/v3/index.json
Which is similar to when we used to run Boots on Xamarin Forms. Obviuously now we will have to do this step for our unit tests as previously tests wouldn't reference platform code (XF was just a .net standard lib).
Are there any performance tips we can use to speed this process up on our CI agents? It was always an issue in XF with Boots but now if we are forced to installing workloads before a build, sometimes the process can take a really long time:
Anything we can do to speed this up? 😄
I'm working with the customer experiencing this issue. To be clear it is not a Tizen issue. Tizen is not being targeted but the build error implies dependency on Tizen despite one not existing. Current theory is that the error message is misleading and is actually complaining about missing MAUI workloads in general.
Just noting that our team hit this issue back on 11/22/2022, we believe it originally surfaced following an upgrade of Visual Studio 2022. We originally installed the maui-tizen workload from the Package Manager Console:
dotnet workload install maui-tizen
After a reboot, the issue seemed to be resolved. Interestingly enough, this issue seems to have resurfaced a couple of days ago on 1/11/2022 after what I believe may have been a failed VS 2022 upgrade on 1/10/2022 to version 17.4.4:
second that problem, with update to vs 17.4.4 our build broke, with the described problem, despite we do not use tizen, nor do we have added it as TargetFramework
Like said by @BenBtg this is not related with Tizen, but just a manifestation that no maui workload is installed. In a CI scenario we have some pointers here on this blog post.
But basically one needs to install maui workload after setup the .net sdk.
I have opened a issue on the dotnet/sdk for a investigation and maybe a better exception.
Basically. the fix is just to add this to your yaml after installing .net version you want
- task: Bash@3
displayName: Install MAUI
inputs:
targetType: 'inline'
script: |
dotnet workload install maui