InternalsVisibleTo Exlusions #76005
-
With the increased updates to the language and compilers, new features are available that can still be used backwards compatibly. The only caveat with this is when something like a new attribute for the compiler is added, that older runtimes don't know about, so you can't use it. There are workarounds though, such as Polyfill libraries, and these work great. Until you start using InternalsVisibleTo. Unfortunately this is a global on or off switch, and can present problems in certain scenarios. For example: Net standard 2.0 project wants to use a new compiler attribute, so brings in a Polyfill library. These generally will source generate you the same definition as what the later .NET versions have, and make it internal to your assembly. Net 8.0+ project, which references the net standard 2.0 project, and is allowed to view its internals. You've now got a Type conflict, because your later runtime already has that attribute definition, and your netstandard project is also defining it, and because they're the same namespace and type name, the compiler doesn't know what to do. Proposal: Add an |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
dotnet/csharplang#8848 proposes adding a new accessibility for types which includes the current assembly but excludes assemblies referenced by |
Beta Was this translation helpful? Give feedback.
dotnet/csharplang#8848 proposes adding a new accessibility for types which includes the current assembly but excludes assemblies referenced by
[InternalsVisibleTo]
.