2.170.1\Modules\DTAExecutionHost.exe' failed with exit code 1 - azure-devops

I am trying to run my automation pipeline on Private hosted agent and getting error as Test Run Failed.
Error: The process 'C:\agent_work_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.170.1\Modules\DTAExecutionHost.exe' failed with exit code 1
Vstest failed with error. Check logs for failures. There might be failed tests.

Error: The process 'C:\agent_work_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.170.1\Modules\DTAExecutionHost.exe' failed with exit code 1 Vstest failed with error. Check logs for failures. There might be failed tests.
Based on the error message, the reason for this issue should be that the VSTest task supported .Net Framework 4.6.2 from version 2.170.1.
You need to check the .NET framework version installed on the build agent machine. If the .NET framework version installed on the machine is 4.6.1 or less than that then can you please try upgrading the .Net framework version to 4.6.2.
Here is a doc about the requirement about the Visual Studio test task:
If you're using a Windows self-hosted agent, be sure that your machine
has this prerequisite installed:
.NET Framework 4.6.2 or a later version
In addition, you can try to use the Visual Studio test task version 1.

Related

.NET 6 Integration tests in Visual Test give error - The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found

I have migrated an integration test project from .Net Framework 4.8 to .NET6. The tests are running fine in local development machine. But when the same code is run using visual studio test task in Azure Devops release pipeline it is giving me the following error
HTTP Error 500.31 - ANCM Failed to Find Native Dependencies.
The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.
Based on some of the suggestions for similar issue, I installed .Net 6 core runtime using use .net core task, and also gave console options as below to force the runtime version, but the error doesn't go away. The project is configured to run on Any CPU.
console options: /Platform:x64 /Framework:.NetCoreApp,Version=v6.0 /logger:trx;LogFileName=netcore-results.trx

dotnet workload restore for MAUI fails with .NET 7

Fails to install workloads for MAUI for .NET 7 when running in azure dev ops. I was running the same pipeline in .NET 6 and it worked fine, but when I updated to .NET 7, it started failing to install the MAUI workload.
YAML
- task: UseDotNet#2
displayName: 'Use .NET Core sdk 7.x'
inputs:
version: 7.x
- task: DotNetCoreCLI#2
displayName: 'dotnet workload'
inputs:
command: custom
custom: 'workload '
arguments: 'install maui'
Logs
Installing pack Microsoft.Maui.Core.Ref.android version 7.0.0-rc.1.6430...
Workload installation failed. Rolling back installed packs...
Rolling back pack Microsoft.Maui.Core.Ref.android installation...
Workload installation failed: Unable to load the service index for source https://nuget.telerik.com/v3/index.json.
##[debug]Exit code 1 received from tool 'C:\hostedtoolcache\windows\dotnet\dotnet.exe'
##[debug]STDIO streams have closed for tool 'C:\hostedtoolcache\windows\dotnet\dotnet.exe'
##[error]Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1
##[debug]Processed: ##vso[task.issue type=error;]Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1
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
##[debug]task result: Failed
##[error]Dotnet command failed with non-zero exit code on the following projects :
##[debug]Processed: ##vso[task.issue type=error;]Dotnet command failed with non-zero exit code on the following projects :
##[debug]Processed: ##vso[task.complete result=Failed;]Dotnet command failed with non-zero exit code on the following projects :
Finishing: dotnet workload
Comments
It is strange that is trying to install the MAUI workload 7.0.0-rc.1.6430 even though I am using the latest .NET 7 and not the release candidate.
This exact pipeline was working with .NET 6
I was able to fix this by specifying the --source on the command. I think me having external nuget sources for private feeds was interfering with it selecting the correct workload version somehow.
- task: DotNetCoreCLI#2
displayName: 'dotnet workload'
inputs:
command: custom
custom: 'workload '
arguments: 'install maui --source https://api.nuget.org/v3/index.json'
Installing pack Microsoft.Maui.Core.Ref.android version 7.0.0-rc.1.6430..
When you run the dotnet workload install maui, it will install maui according to the .net SDK version specified in global.json file firstly.
When you have a global.json file in your project, it will keep the version specified in the file even if you install the latest .NET 7 in the Pipeline.
To solve this issue, you can modify the global.json file and define the .net version(7.0.100).
For example:
{
"sdk": {
"allowPrerelease": true,
"rollForward": "disable",
"version": "7.0.100"
}
}
You can disable the rollForward in global.json file. Then it will not automatically upgrade the dotnet version of the project.
When you run the pipeline with the global.json above, it will use the version: Microsoft.Maui.Core.Ref.android version 7.0.49. This is the latest version of Maui.
Result:

How can I solve error in teamcity (Nunit)?

Recently our NUnit build configuration has occasionally stopped halfway through the tests, but the overall build outcome is successful . When I look at the build log, the last test that actually got executed shows:
Process exited with code -100 (Step: tests (NUnit))
and then the build stops. Under "Failure Conditions". Our NUnit Consol is 3.10.0 .
Below is our NUnit configuration image.
I've found this comment in the TeamCity YouTrack. Seems, dotnet projects aren't supported in NUnit build step.
Try to use .NET CLI build step with "dotnet test" command to run tests in this project. Does it work?

Nunit 3.2.1 Tests not discovered on Visual Studio Test explorer

This is my configuration:
Visual Studio Enterprise 2015
NUnit 3.2.1
NUnit3 Test Adapter 3.0.10 (Installed as Extensions and Updates as well as through nuget package manager in project)
Target Framework is set to 4.5
Build succeeds fine but test discovery shows an error and 0 tests are discovered.
Error log:
Exception NUnit.Engine.NUnitEngineException, Exception thrown discovering tests in C:\projects\~
The NUnit 3.0 driver does not support the portable version of NUnit.
Use a platform specific runner.
NUnit Adapter 3.0.10.0: Test discovery complete.
Discover test finished: 0 found
When running the NUnit 3 Adapter (correct name) version 3.0.10, you are using NUnit 3.0.1 to run your tests. If the tests use the 3.2.1 framework, then there is some chance of an incompatibility. NUnit runners are always backward compatible. For example, you could use NUnit 3.2 to run NUnit 3.0 tests, but the reverse is not true.
The message you are seeing is actually misleading and was changed in the code recently. It assumes you are runing a portable test when a serialization exception occurs.

Teamcity NUnit fails when using JetBrains dotCover

My build fails with this log:
[12:13:40]: Checking for changes
[12:13:41]: Clearing temporary directory: C:\TeamCity\buildAgent\temp\buildTmp
[12:13:41]: Checkout directory: C:\TeamCity\buildAgent\work\9fecf8ffe0e03cce
[12:13:41]: Updating sources: server side checkout...
[12:13:41]: Publishing internal artifacts (4s)
[12:13:41]: Step 1/3: Visual Studio (sln) (17s)
[12:13:58]: Step 2/3: NUnit (19s)
[12:13:58]: Starting: C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe #TeamCityImplicit
[12:13:58]: in directory: C:\TeamCity\buildAgent\work\9fecf8ffe0e03cce
[12:14:02]: JetBrains dotCover Console Runner v1.1.252.2. Copyright (c) 2009-2011 JetBrains s.r.o. All rights reserved.
[12:14:05]: Coverage session started [18.8.2011 12:14:05]
[12:14:09]: Start TeamCity NUnit Test Runner
[12:14:09]: Running NUnit-2.5.10 tests under .NET Framework v2.0 x86
[12:14:10]: MySolution.Communication.Tests.dll
[12:14:10]: MySolution.Communication.Tests.TestClass.CanUseGetRequestPacket
[12:14:18]: Coverage session finished [18.8.2011 12:14:18]
[12:14:18]: Analysed application exited with code '255'
[12:14:18]: Coverage session finished but no snapshots were created.
[12:14:18]: Process exited with code -2
[12:14:18]: Step NUnit failed
[12:14:18]: Build step Duplicates finder (.NET) skipped because of previous step failure
[12:14:18]: Publishing internal artifacts
[12:14:18]: Build finished
I am using Teamcity Professional 6.5.2, NUnit-2.5.10 v2.0 MSIL and build-in JetBrains dotCover. Without JetBrains dotCover all is ok. At another project I am using same configuration and all is ok as well. Could be here some problem with my tests assembly?
dotCover fails with obfuscated assemblies.