-
Notifications
You must be signed in to change notification settings - Fork 323
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
Azure Pipelines VSTest task fails after Microsoft.NET.Test.Sdk is updated from 16.2 to 16.3 #2218
Comments
@nkristek we have identified this issue, & it's happening because in the latest SDK we also drop testhost.dll along with the test assembly. Now since your test filter says to pick any test..dll we also try to run test for testhost.dll which is failing abruptly. We apologize for this, & we have already raised a PR to fix this #2206 To help you mitigate it for now we recommend that you either downgrade the SDK version, or modify your test filter to exclude testhost*. |
I see similar behavior with another repository Smaragd and GitHub Actions, but the error message is a bit different: It has the following targets:
Commit GitHub Actions configuration: name: CI
on: [push, pull_request]
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.0.100'
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --no-restore --no-build --configuration Release |
The previous version failed on the Github Actions 'windows-2019' environment with following log: ---- ##[warning]Startup.cs(104,13): warning CS0618: 'IHostingEnvironment' is obsolete: 'This type is obsolete and will be removed in a future version. The recommended alternative is Microsoft.AspNetCore.Hosting.IWebHostEnvironment.' [D:\a\elm-fullstack\elm-fullstack\implement\PersistentProcess\PersistentProcess.WebHost\PersistentProcess.WebHost.csproj] Startup.cs(28,35): warning ASP0000: Calling 'BuildServiceProvider' from application code results in an additional copy of singleton services being created. Consider alternatives such as dependency injecting services as parameters to 'Configure'. [D:\a\elm-fullstack\elm-fullstack\implement\PersistentProcess\PersistentProcess.WebHost\PersistentProcess.WebHost.csproj] ##[warning]TestWebHost.cs(724,27): warning CS0649: Field 'TestWebHost.Web_host_propagates_HTTP_headers_Response_Entry.name' is never assigned to, and will always have its default value null [D:\a\elm-fullstack\elm-fullstack\implement\PersistentProcess\PersistentProcess.Test\PersistentProcess.Test.csproj] ##[warning]TestWebHost.cs(726,29): warning CS0649: Field 'TestWebHost.Web_host_propagates_HTTP_headers_Response_Entry.values' is never assigned to, and will always have its default value null [D:\a\elm-fullstack\elm-fullstack\implement\PersistentProcess\PersistentProcess.Test\PersistentProcess.Test.csproj] Test run for D:\a\elm-fullstack\elm-fullstack\implement\PersistentProcess\PersistentProcess.Test\bin\Debug\netcoreapp3.0\PersistentProcess.Test.dll(.NETCoreApp,Version=v3.0) Microsoft (R) Test Execution Command Line Tool Version 16.3.0 Copyright (c) Microsoft Corporation. All rights reserved. Starting test execution, please wait... A total of 1 test files matched the specified pattern. Testhost process exited with error: A fatal error occurred, the required library hostfxr.dll could not be found. If this is a self-contained application, that library should exist in [D:\a\elm-fullstack\elm-fullstack\implement\PersistentProcess\PersistentProcess.Test\bin\Debug\netcoreapp3.0\]. If this is a framework-dependent application, install the runtime in the default location [C:\Program Files\dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location. . Please check the diagnostic logs for more information. Results File: D:\a\elm-fullstack\elm-fullstack\implement\PersistentProcess\PersistentProcess.Test\TestResults\runneradmin_fv-az75_2019-10-30_10_14_51.trx Test Run Aborted. ##[error]Process completed with exit code 1.
Using Github actions to run the test should enable people to get test results without creating a PR or setting up their own Azure Pipeline. So far, the Azure Pipelines provide a nicer view of test results, so we keep that for now. The package version change is to work around an issue seen on the Github actions `windows-2019` environment: microsoft/vstest#2218 (comment)
I am facing this issue one again, any workarounds please let me know |
Errors when running tests task related to testhost... following some guidance from here to exclude that dll from being tested itself microsoft/vstest#2218 (comment)
Have you tried updating to the newest version? |
Removing AnyCPU from my unit test project's csproj fixed this issue for me and my tests are running in the pipeline. I'm thinking this AnyCPU PlatformTarget setting would default to x64 on the build server causing a mismatch in bitness, therefore the library found was mismatched. Hope this helps someone. netcoreapp2.1 EDIT: My error was along the lines of "testhost process exited with error: failed to load the dll from [....hostfxr]. the library hostfxr.dll was found but loading it from [....] failed" |
Yes I updated to newest version. It is working fine
…On Tue, 4 Aug, 2020, 7:33 PM Rob Smitha, ***@***.***> wrote:
Removing AnyCPU from my unit test project's csproj fixed this issue for me
and my tests are running in the pipeline. I'm thinking this AnyCPU
PlatformTarget setting would default to x64 on the build server causing a
mismatch in bitness, therefore the library found was mismatched. Hope this
helps someone.
netcoreapp2.1
Runtime: 2.1.19
win10-x86
Microsoft.NET.Test.Sdk 16.6.1
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2218 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGQE5CS633SCBWUCREZX7CTR7AIL7ANCNFSM4I6RUDQQ>
.
|
I am still getting this error when using |
@mayankbansal018 I think this should be re-opened. I'm seeing the same issue on |
I'm also getting this issue on 16.9.4 with .NET 6. I'll open a new issue and link it. |
Description
Starting with the most recent commit to my project Stein the CI build provided by Azure Pipelines fails.
The build in question: https://dev.azure.com/nkristek/Stein/_build/results?buildId=148
Specifically the VSTest task fails with the error:
Previously everything ran fine, this commit updated dependencies. Specifically the
Microsoft.NET.Test.Sdk
was updated from 16.2 to 16.3.I reran the previous commit with success: https://dev.azure.com/nkristek/Stein/_build/results?buildId=149
This seems to indicate that the new version of
Microsoft.NET.Test.Sdk
produces this error.Steps to reproduce
Run Azure Pipelines build with the following repository and settings:
Repository: https://github.com/nkristek/Stein
Configuration: https://github.com/nkristek/Stein/blob/master/azure-pipelines.yml
Expected behavior
The VSTest task succeeds.
Actual behavior
The VSTest task fails with the error:
Diagnostic logs
Environment
Configuration: https://github.com/nkristek/Stein/blob/master/azure-pipelines.yml:
The text was updated successfully, but these errors were encountered: