If an assembly: attribute with a single params parameter is used with multiple values before the assembly: VogenDefaults attribute in the same file, then the following warning is generated:
warning CS8785: Generator 'ValueObjectGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'InvalidOperationException' with message 'TypedConstant is an array. Use Values property.'.
Products:
VS 17.9.6
.NET 8.0.204
Vogen 4.0.3
Steps to reproduce
In a blank project, use the following code
using Vogen;
[assembly: Test(1, 2, 3, 4)]
[assembly: VogenDefaults(conversions: Conversions.Default | Conversions.LinqToDbValueConverter)]
Console.WriteLine("Test");
[AttributeUsage(AttributeTargets.Assembly)]
public sealed class TestAttribute(params int[] Values) : Attribute;
[ValueObject]
public readonly partial record struct TestId;
Expected behaviour
The [assembly: Test(1, 2, 3, 4)] will have no impact on the VogenDefaults attribute.
NB: switching the order, so that the Test attribute comes after VogenDefaults causes the build to work successfully.
Describe the bug
If an
assembly:
attribute with a singleparams
parameter is used with multiple values before theassembly: VogenDefaults
attribute in the same file, then the following warning is generated:Products:
Steps to reproduce
In a blank project, use the following code
Expected behaviour
The
[assembly: Test(1, 2, 3, 4)]
will have no impact on theVogenDefaults
attribute.NB: switching the order, so that the
Test
attribute comes afterVogenDefaults
causes the build to work successfully.