Let's say you have assembly A and assembly B, with B referencing A.
Assembly A declares [assembly: InternalsVisibleTo("B")]. Both assemblies make use of [AutoConstructor].
You'll get this warning when compiling assembly B:
warning CS0436: The type 'AutoConstructorAttribute' in 'AutoConstructor.Generator\AutoConstructor.Generator.AutoConstructorGenerator\AutoConstructorAttribute.cs' conflicts with the imported type 'AutoConstructorAttribute' in 'A, Version=1.2.3.4, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'AutoConstructor.Generator\AutoConstructor.Generator.AutoConstructorGenerator\AutoConstructorAttribute.cs'.
I compile with warnings-as-errors so this actually prevents me from compiling. Thankfully you can suppress this warning, which also prevents it from turning into an error, via .editorconfig (or elsewhere) and then the compiler is happy:
# CS0436: Type conflicts with imported type
# Ensures that per-assembly source-generated attributes, e.g. [AutoConstructor], will not raise errors
dotnet_diagnostic.CS0436.severity = none
@Sergio0694 just fixed this exact issue in a new generator by emitting the suppression automatically and only for the type in question.
Let's say you have assembly A and assembly B, with B referencing A.
Assembly A declares
[assembly: InternalsVisibleTo("B")]
. Both assemblies make use of[AutoConstructor]
.You'll get this warning when compiling assembly B:
I compile with warnings-as-errors so this actually prevents me from compiling. Thankfully you can suppress this warning, which also prevents it from turning into an error, via
.editorconfig
(or elsewhere) and then the compiler is happy:@Sergio0694 just fixed this exact issue in a new generator by emitting the suppression automatically and only for the type in question.