From 1c1d35d1cc2683ec0fac0d855666e4d20e6a43ba Mon Sep 17 00:00:00 2001 From: Thomas Bruderer Date: Mon, 4 Dec 2023 16:23:10 +0100 Subject: [PATCH] Add an external alias to ignore the duplicate ModuleInitializerAttribute * I don't know why this happens, the ModuleInitializerAttribute is internal --- .../Funcky.SourceGenerator.Test.csproj | 4 +++- Funcky.SourceGenerator.Test/ModuleInitializer.cs | 12 ++++++++++++ Funcky.SourceGenerator.Test/TestHelper.cs | 3 +++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 Funcky.SourceGenerator.Test/ModuleInitializer.cs diff --git a/Funcky.SourceGenerator.Test/Funcky.SourceGenerator.Test.csproj b/Funcky.SourceGenerator.Test/Funcky.SourceGenerator.Test.csproj index 26d891a9..04f7f22d 100644 --- a/Funcky.SourceGenerator.Test/Funcky.SourceGenerator.Test.csproj +++ b/Funcky.SourceGenerator.Test/Funcky.SourceGenerator.Test.csproj @@ -26,7 +26,9 @@ - + + SourceGeneneratorAlias + diff --git a/Funcky.SourceGenerator.Test/ModuleInitializer.cs b/Funcky.SourceGenerator.Test/ModuleInitializer.cs new file mode 100644 index 00000000..90295c49 --- /dev/null +++ b/Funcky.SourceGenerator.Test/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace Funcky.SourceGenerator.Test; + +public static class ModuleInitializer +{ + [ModuleInitializer] + public static void Init() + { + VerifySourceGenerators.Enable(); + } +} diff --git a/Funcky.SourceGenerator.Test/TestHelper.cs b/Funcky.SourceGenerator.Test/TestHelper.cs index d492dc68..ba044835 100644 --- a/Funcky.SourceGenerator.Test/TestHelper.cs +++ b/Funcky.SourceGenerator.Test/TestHelper.cs @@ -1,6 +1,9 @@ +extern alias SourceGeneneratorAlias; + using System.Collections.Immutable; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; +using OrNoneFromTryPatternGenerator = SourceGeneneratorAlias::Funcky.SourceGenerator.OrNoneFromTryPatternGenerator; namespace Funcky.SourceGenerator.Test;