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

XUnit tests on net462 are skipped due to Strong name signature verification. #14091

Closed
4 tasks
JRahnama opened this issue Oct 7, 2023 · 5 comments
Closed
4 tasks

Comments

@JRahnama
Copy link

JRahnama commented Oct 7, 2023

  • [ x] This issue is blocking
  • At SqlClient team, we have started to use Microsoft.DotNet.XUnitExtensions from Arcade source provider and trying to remove our internal build of the package to benefit from latest improvements. While working on the task I noticed all net462 tests are skipped with a note:
 [xUnit.net 00:00:01.41] Skipping: ManualTests (could not load dependent assembly 'Microsoft.DotNet.XUnitExtensions, Version=9.0.0'): Could not load file or assembly 'Microsoft.DotNet.XUnitExtensions, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name signature could not be verified.  The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)

NetCore is working fine.
I have tested with:

Microsoft.DotNet.XUnitExtensions 9.0.0-beta.23506.2
Microsoft.DotNet.XUnitExtensions 8.0.0-beta.23505.1
XUnit 2.5.1

Could be checked at PR #2033 on SqlClient repo.

  • This issue is causing unreasonable pain

Release Note Category

  • Feature changes/additions
  • Bug fixes
  • Internal Infrastructure Improvements

Release Note Description

@JRahnama JRahnama changed the title net462 skipping test due to Strong name signature could not be verified. XUnit tests on net462 are skipped due to Strong name signature verification. Oct 7, 2023
@ViktorHofer
Copy link
Member

Is that happening inside VS only or also with dotnet test / dotnet build /t:Test?

@JRahnama
Copy link
Author

JRahnama commented Oct 11, 2023

@ViktorHofer this is happening on 1ES images. windows-2022 image and this is the link to what is included in that image:
https://github.com/actions/runner-images/blob/win22/20230924.1/images/win/Windows2022-Readme.md

It happens with dotnet test and I have not tried other scenarios.

@ViktorHofer
Copy link
Member

ViktorHofer commented Oct 11, 2023

I don't understand the problem fully yet but it has to with full strong name signature verification on .NET Framework when using appdomains.

Here's what we do in our repositories to make this work:

Add a xunit.runner.json file to your project and make sure that it gets copied to the output directory:

{
  "shadowCopy": false
}

In the test project:

  <ItemGroup>
    <None Update="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
  </ItemGroup>

EDIT: see dotnet/runtime#17313 (comment) & https://stackoverflow.com/questions/60058571/unit-testing-public-signed-net-core-framework-libraries for more details

@missymessa
Copy link
Member

@JRahnama was Viktor's comment able to resolve your issue?

@JRahnama
Copy link
Author

@missymessa I just tested and can confirm the issue is fixed. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants