-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: #589 InvalidOperationException in Vogen 4.0.3
Fixes a recently introduced bug where Vogen assumed that the first global attribute in an assembly is the relevant one for it.
- Loading branch information
Showing
5 changed files
with
673 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
tests/SnapshotTests/BugFixes/Bug581_StjDeserializer_throws_correct_exception.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
using System.Threading.Tasks; | ||
using Shared; | ||
using VerifyXunit; | ||
using Vogen; | ||
|
||
|
40 changes: 40 additions & 0 deletions
40
tests/SnapshotTests/BugFixes/Bug589_Vogen_does_not_ignore_irrelevant_assembly_attributes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System.Threading.Tasks; | ||
using Shared; | ||
using VerifyXunit; | ||
using Vogen; | ||
|
||
namespace SnapshotTests.BugFixes; | ||
|
||
// See https://github.com/SteveDunn/Vogen/issues/589 | ||
[UsesVerify] | ||
public class Bug589_Vogen_does_not_ignore_irrelevant_assembly_attributes | ||
{ | ||
[Fact] | ||
public async Task Test() | ||
{ | ||
var source = """ | ||
using System; | ||
using Vogen; | ||
[assembly: Test(1, 2, 3, 4, 5)] | ||
[assembly: VogenDefaults(conversions: Conversions.Default | Conversions.LinqToDbValueConverter)] | ||
[AttributeUsage(AttributeTargets.Assembly)] | ||
#pragma warning disable CS9113 // Parameter 'Values' is unread | ||
public sealed class TestAttribute(params int[] Values) : Attribute | ||
{ | ||
} | ||
[ValueObject] | ||
public partial struct Vo | ||
{ | ||
} | ||
"""; | ||
|
||
await new SnapshotRunner<ValueObjectGenerator>() | ||
.WithSource(source) | ||
.IgnoreInitialCompilationErrors() | ||
.RunOn(TargetFramework.Net8_0); | ||
} | ||
} |
Oops, something went wrong.