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

.NET Standard 1.x project build break from ThisAssembly's use of ExcludeFromCodeCoverage #452

Closed
maxkatz6 opened this issue Mar 15, 2020 · 2 comments · Fixed by #453
Closed
Assignees
Labels
Milestone

Comments

@maxkatz6
Copy link

New attribute was added to ThisAssembly auto-generatred file with condition '#if NETSTANDARD || NETFRAMEWORK || NETCOREAPP'. But ExcludeFromCodeCoverage itself available only from NETSTANDARD2_0.

Minimal repro: use Nerdbank.GitVersioning in netstandard1.4 project.
Workaround: declare ExcludeFromCodeCoverage in user code.

image

Full error:
CS0234 The type or namespace name 'ExcludeFromCodeCoverage' does not exist in the namespace 'System.Diagnostics.CodeAnalysis' (are you missing an assembly reference?) Assembly (netstandard1.1)

@maxkatz6
Copy link
Author

I see two possible solutions:

  1. In condition should be long list of target frameworks, where ExcludeFromCodeCoverage is not available. Like "#if NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 ... || NETCOREAPP1_0". And I am not sure about some UWP and Xamarin frameworks.
  2. Use special constant, which can be defined by used. Like 'NULLABLE_ATTRIBUTES_INCLUDE_IN_CODE_COVERAGE' in https://github.com/manuelroemer/Nullable

@AArnott AArnott added the bug label Mar 15, 2020
@AArnott AArnott self-assigned this Mar 15, 2020
@AArnott AArnott added this to the v3.1 milestone Mar 15, 2020
@AArnott AArnott changed the title [BUG] The type or namespace name 'ExcludeFromCodeCoverage' does not exist in the namespace .NET Standard 1.x project build break from ThisAssembly's use of ExcludeFromCodeCoverage Mar 15, 2020
@maxkatz6
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants