Mono.Cecil fails to load when using Microsoft.Testing.Platform on net472
@fhnaseer is already working on this.
Since Jul 31, 2025.
Assessment
This issue has not been assessed yet.
Description
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
- Dominant language
- C#
- Stars
- 125
- Forks
- 17
- Avg merge
- 1h 17m
- Merged PRs (30d)
- 2
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/codecoverage
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
microsoft/codecoverage#246 · 6 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
microsoft/codecoverage#237 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
microsoft/codecoverage#234 · 1 comment · 2 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
microsoft/codecoverage#233 · 2 reactions ·
-
Difficulty 5/5 Over a week Newbie friendliness 28/100
microsoft/codecoverage#232 · 6 comments ·
All issues in microsoft/codecoverage
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nightscout/nocturne#1379 ·
-
priority-0
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
StackExchange/StackExchange.Redis#3249 ·
-
[Feat] 조합 영역 구분선 개선 Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100