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

Missing strong name when using nunit3testexecutor #40

Closed
MaartenX opened this issue Apr 12, 2018 · 10 comments · Fixed by IT2901-SINTEF01/backend#68, jensenkd/plex-api#26 or luojunyuan/Ve.DotNet#4
Labels
bug Something isn't working in progress

Comments

@MaartenX
Copy link
Contributor

I'm trying to use coverlet with the NUnit3TestAdapter package. However, I get an error message telling me that coverlet.core does not have a strong name. Is it possible to sign the package?

I created the following test project:

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
  <TargetFramework>net461</TargetFramework>
</PropertyGroup>

<ItemGroup>
  <PackageReference Include="coverlet.msbuild" Version="1.0.2" />
  <PackageReference Include="NUnit" Version="3.10.1" />
  <PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
</ItemGroup>

</Project>

The project contains one file, Tests.cs:

using NUnit.Framework;

namespace SimpleTestProject
{
    
    public class Tests
    {
        [Test]
        public void FailingTest()
        {
            Assert.That(false);
        }

        [Test]
        public void SucceedingTest()
        {
            Assert.That(true);
        }
    }
}

If I run the tests using dotnet test I get the following result:

Build started, please wait...
Build completed.

Test run for C:\Users\Maarten\Source\Repos\Allego.Testing.NUnit.Coverage\SimpleTestProject\bin\Debug\net461\SimpleTestProject.dll(.NETFramework,Version=v4.6.1)
Microsoft (R) Test Execution Command Line Tool Version 15.6.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
NUnit Adapter 3.10.0.21: Test execution started
Running all tests in C:\Users\Maarten\Source\Repos\Allego.Testing.NUnit.Coverage\SimpleTestProject\bin\Debug\net461\SimpleTestProject.dll
NUnit3TestExecutor converted 2 of 2 NUnit test cases
NUnit Adapter 3.10.0.21: Test execution complete
Failed   FailingTest
Error Message:
   Expected: True
  But was:  False

Stack Trace:
   at SimpleTestProject.Tests.FailingTest()


Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.
Test Run Failed.
Test execution time: 1,4818 Seconds

However, when I use /p:CollectCoverage=true, I get the following output:

Build started, please wait...
Build completed.

Test run for C:\Users\Maarten\Source\Repos\Allego.Testing.NUnit.Coverage\SimpleTestProject\bin\Debug\net461\SimpleTestProject.dll(.NETFramework,Version=v4.6.1)
Microsoft (R) Test Execution Command Line Tool Version 15.6.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
An exception occurred while invoking executor 'executor://nunit3testexecutor/': Exception has been thrown by the target of an invocation.
Could not load file or assembly 'coverlet.core, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

Kind regards,

Maarten van Sambeek

@tonerdo
Copy link
Collaborator

tonerdo commented Apr 14, 2018

Will explore signing the assembly. Thanks

@tonerdo tonerdo added the bug Something isn't working label Apr 14, 2018
@basilfx
Copy link

basilfx commented May 2, 2018

Any update on this issue? I'm also affected by this.

@roy-uijting
Copy link

+1!

@tonerdo
Copy link
Collaborator

tonerdo commented May 11, 2018

Working to fix this over the weekend

@basilfx
Copy link

basilfx commented May 18, 2018

I found this work-around for the time being.

@basilfx
Copy link

basilfx commented Jun 8, 2018

@tonerdo: Any update on this?

@tonerdo
Copy link
Collaborator

tonerdo commented Jun 12, 2018

Coverlet has been signed and a new release made available: https://www.nuget.org/packages/coverlet.msbuild/2.0.1

@tonerdo
Copy link
Collaborator

tonerdo commented Jun 15, 2018

@basilfx @MaartenX did 2.0.1 fix this?

@basilfx
Copy link

basilfx commented Jun 17, 2018

Yes, this seems to work for me.

@tonerdo
Copy link
Collaborator

tonerdo commented Jun 17, 2018

Awesome. Will close this out, feel free to reopen if you encounter any more issues on this topic

@tonerdo tonerdo closed this as completed Jun 17, 2018
mburumaxwell pushed a commit to faluapp/falu-dotnet that referenced this issue Jun 12, 2021
Bumps [coverlet.collector](https://github.com/coverlet-coverage/coverlet) from 1.3.0 to 3.0.1.

#Release notes

*Sourced from [coverlet.collector's releases](https://github.com/coverlet-coverage/coverlet/releases).*

> ## v3.0.0
> * [#131](coverlet-coverage/coverlet#131) makes a slight change to the Coverlet JSON format
> * 807f7b1bd5bea8158ffff343d5511cd16e0da9a0 uses a separate `coverlet.tracker` assembly to hold tracking code
> * [#128](coverlet-coverage/coverlet#128) adds support for assemblies with `.exe` extension
> * a1f18b4156374f3398d704e898ec58c7c6c64bf8 improves identifying compiler generated types
> * [#134](coverlet-coverage/coverlet#134) adds considerable coverage tracking performance improvements
>
> ## v2.0.1
> * [#102](coverlet-coverage/coverlet#102) fixes issues with NUNIT3 Test adapter ([#101](coverlet-coverage/coverlet#101))
> * [#104](coverlet-coverage/coverlet#104) shows overall averages as part of final console output
> * [#112](coverlet-coverage/coverlet#112) adds support for standard `ExcludeFromCodeCoverage` attribute to specify types and methods to exclude from code coverage. Deprecates `ExcludeFromCoverage` attribute
> * coverlet-coverage/coverlet@7f190e4 prevents Opencover and Cobertura output generated at the same time from overwriting each other ([#111](coverlet-coverage/coverlet#111))
> * [#116](coverlet-coverage/coverlet#116) strongly signs the Coverlet assembly and aims to fix [#40](coverlet-coverage/coverlet#40)
>
> ## v2.0.0
> * [#78](coverlet-coverage/coverlet#78) adds support for generating multiple report formats in a single run
> * [#73](coverlet-coverage/coverlet#73) improves branch coverage support and output formats*
> * coverlet-coverage/coverlet@d2effb3 shows method coverage in summary output
> * [#88](coverlet-coverage/coverlet#88) improves disk usage by using gzip compression
> * [#93](coverlet-coverage/coverlet#93) adds `ThresholdType` property that allows you to specify the coverage type to apply the `Threshold` property to
> * coverlet-coverage/coverlet@ebedd70 renames `Exclude` property to `ExcludeByFile`*
> * coverlet-coverage/coverlet@9ed0864 supports using filter expressions to exclude assemblies, namespaces or types. Uses the `Exclude` property*
> * [#99](coverlet-coverage/coverlet#99) adds improvements to evaluation of filter expressions
>
> `*` - Backwards incompatible change

#Commits

- See f...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment