Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Conditions.OnlyHaveDependenciessOn fails when switch expression is used #101

Closed
TipluSebastian opened this issue Apr 5, 2022 · 1 comment

Comments

@TipluSebastian
Copy link

Hi,

we want to assert that a project only depends on certain assemblies. This check fails if we use a switch-expression in the project under test.

net-arch-switch-bug is a minimal example repository to show the unexpected behaviour of the test: We would expect the test to pass, but it fails.

It is odd, that the test passes if there are 7 or less statements inside the switch-expression (see NotFailingLocalNameTranslator).

Thank you for this nice library.

@NeVeSpl
Copy link
Contributor

NeVeSpl commented May 4, 2022

7 is the magic number for the Roslyn compilator, it generates different code for switch statements and expressions when there are more than 7 options available. In that case, Roslyn introduced a new compiler-generated type of which NetArchTest was not aware of.

BenMorris added a commit that referenced this issue Jun 26, 2022
correction of #101 - handle a new compiler generated type <PrivateImplementationDetails>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants