You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The latest (at the time of this post - 3.1.2) version of Coverlet uses Mono.Cecil 0.11.1. Unfortunately, this is an outdated version of Mono.Cecil that contains some bugs. For example, const null arrays are not processed correctly:
using Mono.Cecil;
using Mono.Cecil.Rocks;
await using var moduleStream = File.OpenRead(typeof(TestClass).Assembly.Location);
using var module = ModuleDefinition.ReadModule(moduleStream, new ReaderParameters { ReadSymbols = true });
var type = module.GetType(string.Empty, nameof(TestClass));
var method = type.GetMethods().Single();
try
{
var debugInformation = method.DebugInformation; // fails on Mono.Cecil 0.11.1, works fine on 0.11.4
Console.WriteLine("Success");
}
catch (Exception ex)
{
Console.WriteLine("Error: {0}", ex);
}
public class TestClass
{
public void TestMethod()
{
const object[]? testVariable = null;
}
}
This prevents Coverlet from instumenting modules and calculating code coverage correctly.
It would be nice if you could update Mono.Cecil dependency to 0.11.4. Thanks in advance.
The text was updated successfully, but these errors were encountered:
Do you have real scenarios where we're failing to instrument/get coverage?
We can bump the deps but it's always risky(we can clash with users deps in some scenarios) and I prefer to do if we've real needs.
Unfortunately, I cannot share any real-world scenarios because of NDAs, but my example from the original post should suffice. Coverlet fails to instrument any assembly that has const array variables like const object[]? foo = null. I can create a pull request with some unit tests for you if you want
Hello.
The latest (at the time of this post - 3.1.2) version of Coverlet uses Mono.Cecil 0.11.1. Unfortunately, this is an outdated version of Mono.Cecil that contains some bugs. For example, const null arrays are not processed correctly:
This prevents Coverlet from instumenting modules and calculating code coverage correctly.
It would be nice if you could update Mono.Cecil dependency to 0.11.4. Thanks in advance.
The text was updated successfully, but these errors were encountered: