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

Attempting to follow guidance from #102 for protobuf but it continues to be instrumented. #176

Closed
simkin2004 opened this issue Dec 7, 2022 · 2 comments
Labels
Third party Problem lies in a consumed library which may or may not have a work-round

Comments

@simkin2004
Copy link

Using AltCover 8.3.838, this line worked on Github build servers ubuntu 20.04.5 successfully at least until 27 OCT 2022.

dotnet test /p:AltCover="true" /p:CopyLocalLockFileAssemblies="true" /p:AltCoverLocalSource=true /p:AltCoverAttributeFilter=ExcludeFromCodeCoverage --configuration Release --no-build --no-restore --verbosity normal

I re-tested on 6 DEC 2022 and it began failing on ubuntu 22.04.1 with the same error as #102.

I attempted to add the following arguments one at a time to the command line above and each failed with the same issue. I followed the guidance for usage from #124
/p:AltCoverAssemblyFilter=protobuf-net
/p:AltCoverAssemblyFilter=protobuf-net.Core
/p:AltCoverAssemblyExcludeFilter=protobuf-net
/p:AltCoverAssemblyExcludeFilter=protobuf-net.Core

I downgraded back to ubuntu 20.04.5 and retested each of these scenarios which all failed with the same error as #102.

I changed to windows-latest to see if I could reproduce the behavior from 27 OCT 2022 on windows and it failed with the same error as #102.

I will upgrade to the latest version to see if that changes anything, but I wanted to check with you to see if I am using the parameters incorrectly.

@SteveGilham
Copy link
Owner

In between those dates, .net 7.0 was released and adopted as the default environment by the GitHub servers. At the initial release, SDK 7.0.100, there is a serious regression with dotnet test in which properties on the command line are not accurately forwarded. In your case, the effective command line being executed is

dotnet test /p:AltCover="true" --configuration Release --no-build --no-restore --verbosity normal

as for some strange reason a property specified as the first argument to dotnet test is still forwarded, unlike any others appearing later.

Until SDK 7.0.101 is released (which is promised to have the fix), the following workrounds are possible -

  1. ensure a dotnet 6.0 SDK is installed, and lock to it in a global.json, carrying on as if it were still October
  2. set properties in the environment instead e.g. in a Bash script
export AltCover=true
export CopyLocalLockFileAssemblies=true
export AltCoverLocalSource=true
export AltCoverAttributeFilter=ExcludeFromCodeCoverage
dotnet test --configuration Release --no-build --no-restore --verbosity normal

See the FAQ for more details

@SteveGilham SteveGilham added the Third party Problem lies in a consumed library which may or may not have a work-round label Dec 8, 2022
@simkin2004
Copy link
Author

Apologies for opening a duplicate of #174.
I just found it with the same information.
Thank you for your kindness, sir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Third party Problem lies in a consumed library which may or may not have a work-round
Projects
None yet
Development

No branches or pull requests

2 participants