Mono.Cecil fails to load when using Microsoft.Testing.Platform on net472

Đang mở
#162 12 bình luận 1 reaction 1 người được giao Xem trên GitHub

@fhnaseer đang làm issue này rồi.

Từ ngày 31/7/2025.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

bug

I'm attempting to adopt Microsoft.Testing.Platform and with it the new Microsoft.Testing.Extensions.CodeCoverage, however net472 tests all fail to run with the error

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Mono.Cecil, Version=0.11.5.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Repro steps

Tests.cs
using Xunit;

public sealed class Tests
{
    [Fact]
    public void MyTest()
    {
        Assert.True(true);
    }
}
Tests.csproj
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>net472;net8.0</TargetFrameworks>
    <TestProject>true</TestProject>
    <OutputType>Exe</OutputType>
    <UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
    <TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
    <TestingPlatformShowTestsFailure>true</TestingPlatformShowTestsFailure>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="FluentAssertions" Version="7.2.0"/>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0"/>
    <PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.13.1" />
    <PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="1.6.2" />
    <PackageReference Include="Moq" Version="4.20.72"/>
    <PackageReference Include="Moq.Analyzers" Version="0.3.0"/>
    <PackageReference Include="xunit.v3" Version="2.0.0"/>
    <PackageReference Include="xunit.runner.visualstudio" Version="3.0.2"/>
  </ItemGroup>

</Project>

and then run dotnet test -- --coverage --coverage-output-format cobertura

Additional info

.NET SDK 9.0.201
Windows 11 24H2 OS Build 26100.3476

Ngôn ngữ chính
C#
Star
125
Fork
17
Merge trung bình
1 giờ 17 phút
Pull request đã merge (30 ngày)
2

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/codecoverage

Tất cả issue của microsoft/codecoverage

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.