From a65291c5eb11ab9d77c54a68c361155da6bb96a1 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Thu, 9 Apr 2026 11:11:37 +0200 Subject: [PATCH] Fixed source generator (#724) --- app/MindWork AI Studio/MindWork AI Studio.csproj | 14 +------------- app/MindWork AI Studio/packages.lock.json | 2 +- .../AnalyzerReleases.Shipped.md | 8 ++++++++ .../AnalyzerReleases.Unshipped.md | 4 ++++ .../MappingRegistryGenerator.cs | 15 +++++++++++---- .../SourceGeneratedMappings.csproj | 16 ++++++---------- 6 files changed, 31 insertions(+), 28 deletions(-) create mode 100644 app/SourceGeneratedMappings/AnalyzerReleases.Shipped.md create mode 100644 app/SourceGeneratedMappings/AnalyzerReleases.Unshipped.md diff --git a/app/MindWork AI Studio/MindWork AI Studio.csproj b/app/MindWork AI Studio/MindWork AI Studio.csproj index 01a9295b..6469e70e 100644 --- a/app/MindWork AI Studio/MindWork AI Studio.csproj +++ b/app/MindWork AI Studio/MindWork AI Studio.csproj @@ -60,21 +60,9 @@ + - - ..\SourceGeneratedMappings\SourceGeneratedMappings.csproj - ..\SourceGeneratedMappings\bin\$(Configuration)\net9.0\SourceGeneratedMappings.dll - - - - - - - - - - diff --git a/app/MindWork AI Studio/packages.lock.json b/app/MindWork AI Studio/packages.lock.json index c4a3fa82..64dc0ee4 100644 --- a/app/MindWork AI Studio/packages.lock.json +++ b/app/MindWork AI Studio/packages.lock.json @@ -235,6 +235,6 @@ "type": "Project" } }, - "net9.0/win-x64": {} + "net9.0/osx-arm64": {} } } \ No newline at end of file diff --git a/app/SourceGeneratedMappings/AnalyzerReleases.Shipped.md b/app/SourceGeneratedMappings/AnalyzerReleases.Shipped.md new file mode 100644 index 00000000..eb32e6da --- /dev/null +++ b/app/SourceGeneratedMappings/AnalyzerReleases.Shipped.md @@ -0,0 +1,8 @@ +## Release 1.0 + +### New Rules + + Rule ID | Category | Severity | Notes +---------|------------------|----------|-------------------------- + MBI001 | SourceGeneration | Info | MappingRegistryGenerator + MBI002 | SourceGeneration | Warning | MappingRegistryGenerator diff --git a/app/SourceGeneratedMappings/AnalyzerReleases.Unshipped.md b/app/SourceGeneratedMappings/AnalyzerReleases.Unshipped.md new file mode 100644 index 00000000..890b26d0 --- /dev/null +++ b/app/SourceGeneratedMappings/AnalyzerReleases.Unshipped.md @@ -0,0 +1,4 @@ +; Unshipped analyzer release +; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md + +### New Rules \ No newline at end of file diff --git a/app/SourceGeneratedMappings/MappingRegistryGenerator.cs b/app/SourceGeneratedMappings/MappingRegistryGenerator.cs index e664a5fe..4a345d2d 100644 --- a/app/SourceGeneratedMappings/MappingRegistryGenerator.cs +++ b/app/SourceGeneratedMappings/MappingRegistryGenerator.cs @@ -9,7 +9,9 @@ using Microsoft.CodeAnalysis.Text; namespace SourceGeneratedMappings; [Generator] +#pragma warning disable RS1036 public sealed class MappingRegistryGenerator : IIncrementalGenerator +#pragma warning restore RS1036 { private const string GENERATED_NAMESPACE = "AIStudio.Tools.PluginSystem.Assistants.Icons"; private const string ROOT_TYPE_NAME = "MudBlazor.Icons"; @@ -26,7 +28,7 @@ public sealed class MappingRegistryGenerator : IIncrementalGenerator private static readonly DiagnosticDescriptor NO_ICONS_FOUND = new( id: "MBI002", title: "No MudBlazor icons were discovered", - messageFormat: "The generator found '{0}', but no nested icon constants were discovered below it.", + messageFormat: "The generator found '{0}', but no nested icon constants were discovered below it", category: "SourceGeneration", DiagnosticSeverity.Warning, isEnabledByDefault: true); @@ -80,8 +82,8 @@ public sealed class MappingRegistryGenerator : IIncrementalGenerator continue; icons.Add(new IconDefinition( - QualifiedName: $"Icons.{groupPath}.{field.Name}", - Svg: svg)); + $"Icons.{groupPath}.{field.Name}", + svg)); } } @@ -126,5 +128,10 @@ public sealed class MappingRegistryGenerator : IIncrementalGenerator return Microsoft.CodeAnalysis.CSharp.SymbolDisplay.FormatLiteral(value, quote: true); } - private sealed record IconDefinition(string QualifiedName, string Svg); + private sealed class IconDefinition(string qualifiedName, string svg) + { + public string QualifiedName { get; } = qualifiedName; + + public string Svg { get; } = svg; + } } \ No newline at end of file diff --git a/app/SourceGeneratedMappings/SourceGeneratedMappings.csproj b/app/SourceGeneratedMappings/SourceGeneratedMappings.csproj index aa671143..9bc8e18a 100644 --- a/app/SourceGeneratedMappings/SourceGeneratedMappings.csproj +++ b/app/SourceGeneratedMappings/SourceGeneratedMappings.csproj @@ -1,7 +1,7 @@ - net9.0 + netstandard2.0 false enable latest @@ -16,14 +16,10 @@ - - $(MSBuildSDKsPath)\..\Roslyn\bincore\Microsoft.CodeAnalysis.dll - false - - - $(MSBuildSDKsPath)\..\Roslyn\bincore\Microsoft.CodeAnalysis.CSharp.dll - false - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + -