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

Instrumentation Error with .NET Core 3.1 #87

Closed
PSanetra opened this issue Jun 29, 2020 · 5 comments
Closed

Instrumentation Error with .NET Core 3.1 #87

PSanetra opened this issue Jun 29, 2020 · 5 comments
Labels
cannot repro Need a simple case of the issue to work from

Comments

@PSanetra
Copy link

Altcover does not seem to work with .NET Core 3.1 (haven't tried with older versions). It fails during the instrumentation phase with the following error:

/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(41,5): error :  [/src/SimpleAppTests/SimpleAppTests.csproj]
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(41,5): error : ERROR *** Instrumentation phase failed [/src/SimpleAppTests/SimpleAppTests.csproj]
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(41,5): error :  [/src/SimpleAppTests/SimpleAppTests.csproj]
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(41,5): error :  [/src/SimpleAppTests/SimpleAppTests.csproj]
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(41,5): error : Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. Could not find or load a specific file. (0x80131621) [/src/SimpleAppTests/SimpleAppTests.csproj]
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(41,5): error : Details written to /src/SimpleAppTests/bin/Debug/netcoreapp3.1/__Saved/AltCover-2020-06-29--09-33-52.log [/src/SimpleAppTests/SimpleAppTests.csproj]
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(41,5): error : If this problem was detected in the pre-test instrumentation stage of `dotnet test`, then the file may have been moved to /src/SimpleAppTests/bin/Debug/netcoreapp3.1/AltCover-2020-06-29--09-33-52.log when the task completes. [/src/SimpleAppTests/SimpleAppTests.csproj]
Test run for /src/SimpleAppTests/bin/Debug/netcoreapp3.1/SimpleAppTests.dll(.NETCoreApp,Version=v3.1)
Microsoft (R) Test Execution Command Line Tool Version 16.3.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...

A total of 1 test files matched the specified pattern.

Test Run Successful.
Total tests: 1
     Passed: 1
 Total time: 0.9339 Seconds
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(125,5): warning : A total of 0 visits recorded [/src/SimpleAppTests/SimpleAppTests.csproj]
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(125,5): error MSB4018: The "AltCover.Collect" task failed unexpectedly. [/src/SimpleAppTests/SimpleAppTests.csproj]
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(125,5): error MSB4018: System.NullReferenceException: Object reference not set to an instance of an object. [/src/SimpleAppTests/SimpleAppTests.csproj]
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(125,5): error MSB4018:    at AltCover.Zip.openUpdate(String report) in C:\projects\altcover\AltCover\CommandLine.fs:line 79 [/src/SimpleAppTests/SimpleAppTests.csproj]
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(125,5): error MSB4018:    at [email protected](FSharpOption`1 arg) in C:\projects\altcover\AltCover\Runner.fs:line 823 [/src/SimpleAppTests/SimpleAppTests.csproj]
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(125,5): error MSB4018:    at [email protected](Unit unitVar0) in C:\projects\altcover\AltCover\Runner.fs:line 893 [/src/SimpleAppTests/SimpleAppTests.csproj]
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(125,5): error MSB4018:    at AltCover.CommandLine.I.doPathOperation[a](FSharpFunc`2 f, a defaultValue, Boolean store) in C:\projects\altcover\AltCover\CommandLine.fs:line 210 [/src/SimpleAppTests/SimpleAppTests.csproj]
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(125,5): error MSB4018:    at [email protected](FSharpFunc`2 f, a defaultValue, Boolean store) in C:\projects\altcover\AltCover\CommandLine.fs:line 395 [/src/SimpleAppTests/SimpleAppTests.csproj]
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(125,5): error MSB4018:    at AltCover.Runner.doCoverage(String[] arguments, OptionSet options1) in C:\projects\altcover\AltCover\Runner.fs:line 876 [/src/SimpleAppTests/SimpleAppTests.csproj]
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(125,5): error MSB4018:    at AltCover.Main.I.main(String[] arguments) in C:\projects\altcover\AltCover\Main.fs:line 525 [/src/SimpleAppTests/SimpleAppTests.csproj]
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(125,5): error MSB4018:    at [email protected](String[] arguments) in C:\projects\altcover\AltCover\Main.fs:line 531 [/src/SimpleAppTests/SimpleAppTests.csproj]
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(125,5): error MSB4018:    at AltCover.Collect.Execute() in C:\projects\altcover\AltCover\Tasks.fs:line 226 [/src/SimpleAppTests/SimpleAppTests.csproj]
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(125,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/src/SimpleAppTests/SimpleAppTests.csproj]
/root/.nuget/packages/altcover/7.1.776/build/netstandard2.0/AltCover.targets(125,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/src/SimpleAppTests/SimpleAppTests.csproj]
The command '/bin/sh -c dotnet test /p:AltCover=true /p:AltCoverCobertura=coverage.xml /p:CopyLocalLockFileAssemblies="true"' returned a non-zero code: 1

I have set up a repository, which can be used to reproduce the error with a Docker image build: https://github.com/PSanetra/reproduce-altcover-error

@SteveGilham
Copy link
Owner

SteveGilham commented Jun 29, 2020

Could not repro with a freshly created docker machine.

2020-06-29

The message

Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. Could not find or load a specific file. (0x80131621)

would appear to indicate some failure or corruption in the installation of the NuGet package, as that assembly forms part of the package manifest.

@SteveGilham SteveGilham added the cannot repro Need a simple case of the issue to work from label Jun 29, 2020
@PSanetra
Copy link
Author

@SteveGilham ok, weird. I am currently also not able to reproduce this issue in a GitHub Actions pipeline. We could reproduce the issue on two different systems (ubuntu and mac os) with a different repository. On my local machine this issue is also appearing in the docker build of the example repository.

We have also discovered that we can not reproduce the issue with version 6.8.761 of altcover.

@SteveGilham
Copy link
Owner

There was some issue (can't recall details at this remove) I had when rolling out the .net core support a couple of years ago, where Newtonsoft.Json was implicated the cause of build (strictly, the whole build-and-validate process) failures. I finally resolved that problem by static-linking that assembly into the main executable.

The .net 3.1.300 SDK had a regression which affects that static linkage, so the 7.x releases have been built without that step, but have seemed to function OK without it. Release 6.8.761 is the last that was done with an older .net SDK and thus with the static linking happening; so if there is a re-emergence of the original problem I had, whatever it was, or something very like, then sticking with a 6.x version would avoid it.

@SteveGilham
Copy link
Owner

Release 7.1.778 replaces the Newtonsoft assembly that is at the root of the issue, plus tidies up the downstream failures.

@PSanetra
Copy link
Author

PSanetra commented Jul 1, 2020

@SteveGilham I can confirm that this issue is fixed with version 7.1.778

@PSanetra PSanetra closed this as completed Jul 1, 2020
SteveGilham added a commit that referenced this issue Aug 2, 2020
…[Nullable] kills later version linkage.

  Hope this doesn't regress #87
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cannot repro Need a simple case of the issue to work from
Projects
None yet
Development

No branches or pull requests

2 participants