Are there any scenarios not related to UnitTesting where InternalsVisibleTo is acceptable

It seems that using this attribute for anything but unit testing non-public methods / properties will be a huge smell of code. Is there a legitimate use of the InternalsVisibleTo attribute to achieve something that is otherwise impossible / too cumbersome using standard design patterns?

+4
source share
2 answers

We used it to create the Microsoft Surface SDK so that certain board assemblies can talk to each other without opening unwanted public APIs. Although this created the burden of manually ensuring that these libraries only use β€œapproved” internal things from each other.

+6
source

Can be used to share code between your own assemblies that you do not want to publicly publish outside.

+4
source

Source: https://habr.com/ru/post/1498968/


All Articles