altcover 8.3.838

.NET Standard 2.0 .NET Framework 2.0
Install-Package altcover -Version 8.3.838
dotnet add package altcover --version 8.3.838
<PackageReference Include="altcover" Version="8.3.838" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add altcover --version 8.3.838
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: altcover, 8.3.838"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install altcover as a Cake Addin
#addin nuget:?package=altcover&version=8.3.838

// Install altcover as a Cake Tool
#tool nuget:?package=altcover&version=8.3.838
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

altcover

Instrumenting coverage tool for .net (framework 2.0+ and core) and Mono assemblies, reimplemented and extended almost beyond recognition from dot-net-coverage, plus a set of related utilities for processing the results from this and from other programs producing similar output formats.

Usage

See the Wiki page for full details

I really want coverage for my .net core unit test project right now

Install into your test project

dotnet add package AltCover

and run

dotnet test /p:AltCover=true

The OpenCover format output will be in file coverage.xml in the project directory

What's in the box?

For Mono, .net framework and .net core, except as noted

  • AltCover, a command-line tool for recording code coverage (net472 and .netcoreapp2.0)
  • MSBuild tasks to drive the tool, including dotnet test integration
  • A PowerShell module for Windows PowerShell 5.1 and PowerShell Core 6+ containing a cmdlet that drives the tool, and other cmdlets for manipulating coverage reports
  • A coverage visualizer tool (net472) -- for .net framework, needs GTK# v2.12.xx installed separately Visualizer screenshot

Why altcover?

As the name suggests, it's an alternative coverage approach. Rather than working by hooking the .net profiling API at run-time, it works by weaving the same sort of extra IL into the assemblies of interest ahead of execution. This means that it should work pretty much everywhere, whatever your platform, so long as the executing process has write access to the results file. You can even mix-and-match between platforms used to instrument and those under test.

In particular, while instrumenting .net core assemblies "just works" with this approach, it also supports Mono, as long as suitable .mdb (or .pdb, in recent versions) symbols are available. One major limitation here is that the .mdb format only stores the start location in the source of any code sequence point, and not the end; consequently any nicely coloured reports that take that information into account may show a bit strangely.

Why altcover? -- the back-story of why it was ever a thing

Back in 2010, the new .net version finally removed the deprecated profiling APIs that the free NCover 1.5.x series relied upon. The first version of AltCover was written to both fill a gap in functionality, and to give me an excuse for a ground-up F# project to work on. As such, it saw real production use for about a year and a half, until OpenCover reached a point where it could be used for .net4/x64 work (and I could find time to adapt everything downstream that consumed NCover format input).

Fast forwards to autumn 2017, and I get the chance to dust the project off, with the intention of saying that it worked on Mono, too -- and realise that it's déja vu all over again, because .net core didn't yet have profiler based coverage tools either, and the same approach would work there as well.

Continuous Integration

Build GitHub Build statusBuild history AppVeyor Build status Build history
Test coverage Coveralls Coverage Status AppVeyor Test status

Possible retirement/obsolescence of support

tl;dr -- legacy framework/Mono support is not going away any time soon.

As net472 can consume netstandard2.0 libraries (everything but the recorder), and .net core 2+ can consume net20 libraries (the recorder), legacy framework/Mono support continues until such a time as it is no longer possible to retain those API levels.

Other NuGet Packages in this suite

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net20 net35 net40 net403 net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (13)

Showing the top 5 popular GitHub repositories that depend on altcover:

Repository Stars
praeclarum/sqlite-net
Simple, powerful, cross-platform SQLite client and ORM for .NET
ardalis/GuardClauses
A simple package with guard clause extensions.
danielpalme/ReportGenerator
ReportGenerator converts coverage reports generated by coverlet, OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov or lcov into human readable reports in various formats.
ardalis/Specification
Base class with tests for adding specifications to a DDD model
lecaillon/Evolve
Database migration tool for .NET and .NET Core projects. Inspired by Flyway.
Version Downloads Last updated
8.3.838 8,110 6/30/2022
8.2.837 44,551 3/10/2022
8.2.836 2,625 3/9/2022
8.2.835 23,430 1/29/2022
8.2.833 47,495 12/12/2021
8.1.819 9,674 4/14/2021

This build from https://github.com/SteveGilham/altcover/tree/6f84ef83d235423c9db38bb334aee80db19f8ac6

Q. Never mind the fluff -- how do I get started?
A. Start with the Quick Start guide : https://github.com/SteveGilham/altcover/wiki/QuickStart-Guide

8.3.838 (Habu series release 14)
• [GTK-VISUALIZER] Fix off-by-one error in markup for the very last line of the file
• [BUGFIX] -- Out-of-process APIs generating dotnet test: fix to allow activating ZipFile, MethodPoint, SingleVisit and SourceLink
• [BUGFIX] -- Issue #156: Out-of-process APIs generating dotnet test: fix /p:AltCoverDependencyList to work around the behaviour of dotnet test with an argument ending .dll or .exe.  Users rolling their own command lines, note that the assembly list is separated and terminated with '|' characters.  The --dependency command line argument for the tool is not affected.
• [BUGFIX] -- Issue #156: Make explicit dependencies through --dependency have priority over other assembly resolution lookup.  This works around a Mono.Cecil misfeature (Mono.Cecil issue #863) where the netstandard2.0 Cecil binaries do not consider the GAC for Framework system assemblies, but instead will find stubs in dotnet/shared/Microsoft.NETCore.App for e.g. .net Framework WPF related assemblies
• [BUGFIX] -- Improve selection of non-embedded symbol files (between location in assembly debug header, the same directory as the assembly and any --symbolDirectory values) to avoid symbol mismatch when there are multiple possible files on offer
• Add a --verboseoption for AltCover, the converse of -q.  Away from the command line, adds meaning to the Verbosity option value System.Diagnostics.TraceLevel.Verbose.  Currently Verbose output shows more of the selection of files for instrumentation, noting when files are excluded from the process, symbol file selection etc.
• Add a matching field, ILoggingOptions.Verbose, to the API as a sink to capture verbose output.
• Other minor build process adjustments for SDK 6.0.300/F# 6.0.4, 6.0.5

8.2.837 (Habu series release 13)
• [VISUALIZER] Critical bug fixes for GTK and Avalonia : mismatched new icon names causing crashes
• [VISUALIZER] Use new coverage data icon for the coverage report file, not a generic report icon

8.2.836 (Habu series release 12)
• [BUGFIX] Fix project file path handling in Cake support
• [BUGFIX] Improve heuristic to recognise (and ignore)  state-machine injected branches in async methods; this may cause subtle changes, up or down, in branch detection for other generated code ("hidden" sequence points) contexts with branches
• Use VS2022 icons in the Visualizer

8.2.835 (Habu series release 11)
• [BUGFIX] Fix tracked methods in the Merge-OpenCover cmdlet
• [BUGFIX] Fix blocking issue in Cake support; and add operational test
• Move Fake.Build support to 5.21 as minimum; updating other supporting libraries

8.2.833 (Habu series release 10)
• [BUGFIX] Work-round more (problems with ill-formed debug data)[https://github.com/jbevain/cecil/issues/816] (issue #135)
• [BUGFIX] An infinite loop while instrumenting when faced with an inner function that is also a closure (also issue #135)
• [BUGFIX] Address issue #71 by pre-allocating storage for each instrumented assembly; rather than allocating on demand, with any timing related issues not adequately dealt with subject to catch-and-ignore
• For instrumented assemblies, write embedded debug symbols, independent of the input choice.
• Improved release note formatting
• Some overhaul and updating of neglected parts of the build and test script
• Reduce to a minimum the differences in the source between the net20 and net46-for-async versions of the recorder; then just rewrite the net20 version with the delta on demand.
• Some minor improvements to the data collector for dotnet test use, with example of how to employ explicitly in AltCover "classic" mode in the "UnitTestWithAltCoverCore" fake build target

8.2.831 (Habu series release 9)
• [BUGFIX] Make the static-linked parts of the recorder assembly internal, so only the AltCover instrumentation API is exposed -- removes type duplications from the environment that may confuse run-time assembly creation e.g. by Marten (issue #133)
• For CallContext, add async-aware tracking for all methods returning Task or Task<T> not just ones with the C# async shape.  This includes functions returning the new F#6 task{} computation expression.
  ◦ Note there is a support gap : running this under .net Framework less than v4.6 (i.e. a test machine with a pre-2015-JUL-20 environment) will not work, even though Task is a .net 4.0 feature, as the tracking support relies on .net 4.6 async features.
• Emit (a warning)[https://stevegilham.github.io/altcover/AltCover.Engine/AltCover/AltCover.LoggingOptions/Warn-apidoc] if any of the files input to the instrumentations have previously been instrumented, leaving those files untouched (apart from any Recorder assembly, which will still be overwritten).  For dotnet test this is an MSBuild warning, for powershell, it is delivered via Cmdlet.WriteWarning.
  ◦ This behaviour is subject to change in future releases
• Rework of the build process to keep artifacts out of the tracked directories

8.2.828 (Habu series release 8)
• Absorb .net 6 release into build tooling (awaiting a non-preview updated release of (fake.build)[https://fake.build/] to be able to upgrade to FSharp.Core 6.x -- still have to target the v5.x library even if the build uses the F#6 compiler)
• Where the debug symbols used in the instrumentation contain embedded source (e.g. from source generators), represent that within the generated report --
  ◦ for OpenCover format, as an altcover.embed attribute added to the File element
  ◦ for NCover classic, altcover.file elements are added after the method records in a module, with attributes document and embed
  ◦ and for the extended coverlet JSON format, as a type «AltCover.embed» with an empty method with name being the embedded text.
• [VISUALIZER] Support the extended formats for display, using the embedded source in preference to the file system whenever present
• Support these extensions in conversions between formats -- conversion to Lcov and Cobertura currently lose this information
• Other fixes/enhancements to these conversions, esp. in the cases of partial classes and inlined code
• Compute summary data correctly in the output from Json to OpenCover
• Carry both recorder versions (net20 and net46) as resources to simplify self-test behaviour
• Move baseline Cake support to v1.1.0 and Fake to v5.20.4

8.2.825 (Habu series release 7)
• Next release will be post .net 6 release to accomodate its impact, barring show-stoppers
• [BUGFIX] As noted in Q&A discussion (#107), satellite assemblies, and in issue #47  platform specific library subfolders, were not being copied appropriately relative to the instrumented location; this is now resolved.
• [BUGFIX] Prevent --localSource possibly excluding locally built assemblies using source generators.
• [VISUALIZER] Fixes and updates
  ◦ On the global tool, don't put expander icons (˃) on leaf nodes, i.e. most methods, all source -- such icons are an automatic feature in GTK, but are manual in Avalonia.
  ◦ Don't throw while trying to determine if a file that doesn't exist is outdated

8.2.824 (Habu series release 6c)
• [VISUALIZER] Fixes and updates
  ◦ [REGRESSION] Fix where multiple source file support broke JSON coverage support
  ◦ Not all coverage reports are XML -- fix root node icon
  ◦ Add more icons indicating non-default states (files missing, changed, via sourcelink &c)
  ◦ Replace most of the annoying pop-ups with tool-tips

8.2.823 (Habu series release 6b)
• [VISUALIZER] Fixes and updates
  ◦ [REGRESSION] Fix where multiple source file support broke methods with no source file
  ◦ [BUGFIX] Fix where some types were erroneously shown as functions (ƒₓ)
  ◦ Allow for TAB characters (which occupy 1 column only in the .PDB), and display → rather than ◻ in the global tool (TAB expands to 8 spaces in the GTK# build)
  ◦ Update icons to VS2019 from VS2017 (except where taken from GTK in the GTK# build), which means slightly more colours in the tree view, and a small change to the branch indicator.

8.2.822 (Habu series release 6a)
• [VISUALIZER] Support OpenCover's output from C++/CLI assemblies compiled /Zi (line information only, zero column values)
  ◦ account for (& simplify) the C++/CLI attribute decorations in method names
  ◦ allow for (& simplify) gcroot<type::with::Cpp::namespacing ^> types in method names
  ◦ allow source file selection for methods with code inlined from multiple source files

8.2.821 (Habu series release 6)
• Support deterministic builds /p:ContinuousIntegrationBuild=true, with or without --sourcelink//p:AltCoverSourceLink=true.  Note that assemblies created by deterministic builds will be excluded by -l//p:AltCoverLocalSource=true.
• Experiment with the ReadMe feature recently added to NuGet
• Internal refactoring of the JSON processing following the replacement of System.Text.Encodings.Web in the previous release.

8.2.820 (Habu series release 5)
• Replace System.Text.Encodings.Web for JSON-escaping module, class and method names
• [BUGFIX] issue #125 -- prevent an NullReferenceException in some cases of computing cyclomatic complexity (a failure to exactly copy the algorithm from Mono.Gendarme)
• [ENHANCEMENT; API] issue #126 -- further generalise the relative-directory support for CopyAlways/CopyIfNewer from v7.4; extends the ContingentCopy MSBuild task

For previous releases (8.1.x and earlier) go here -- https://github.com/SteveGilham/altcover/blob/master/ReleaseNotes%20-%20Previously.md