From 1400bd08e0b60f4df61b9869cce627146ad286f1 Mon Sep 17 00:00:00 2001 From: Wvader <34067397+wvader@users.noreply.github.com> Date: Tue, 23 Aug 2022 17:48:47 +0100 Subject: [PATCH] Prepare for Add/Update generators --- src/BlueWest.MapTo/Extensions/CommonSource.cs | 3 +++ src/BlueWest.MapTo/MappingContext.cs | 9 ++++++--- src/BlueWest.MapTo/Sources/UpdateDataAttributeSource.cs | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/BlueWest.MapTo/Extensions/CommonSource.cs b/src/BlueWest.MapTo/Extensions/CommonSource.cs index 4553839..ee18ed0 100644 --- a/src/BlueWest.MapTo/Extensions/CommonSource.cs +++ b/src/BlueWest.MapTo/Extensions/CommonSource.cs @@ -6,6 +6,7 @@ using System.Text; using System.Collections.Immutable; using System.Diagnostics; using Microsoft.CodeAnalysis; +#pragma warning disable CS8602 namespace MapTo.Extensions { @@ -207,7 +208,9 @@ namespace MapTo.Extensions private static void HandleEnumerable(SourceBuilder builder, MappedMember property) { var symbol = property.ActualSymbol as IPropertySymbol; +#pragma warning disable CS8602 builder.WriteCommentArray(symbol.Parameters, nameof(symbol.Parameters)); +#pragma warning restore CS8602 builder.WriteCommentArray(symbol.TypeCustomModifiers, nameof(symbol.TypeCustomModifiers)); builder.WriteComment($"Is enumerable {(property.ActualSymbol as IPropertySymbol).Parameters}"); diff --git a/src/BlueWest.MapTo/MappingContext.cs b/src/BlueWest.MapTo/MappingContext.cs index 1f02b39..7d53c76 100644 --- a/src/BlueWest.MapTo/MappingContext.cs +++ b/src/BlueWest.MapTo/MappingContext.cs @@ -6,6 +6,7 @@ using MapTo.Extensions; using MapTo.Sources; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; +#pragma warning disable CS8602 namespace MapTo { @@ -52,7 +53,7 @@ namespace MapTo protected INamedTypeSymbol UseUpdateAttributeTypeSymbol { get; } - public static INamedTypeSymbol JsonExtensionAttributeSymbol { get; set; } + public static INamedTypeSymbol JsonExtensionAttributeSymbol { get; set; } = null!; protected INamedTypeSymbol MappingContextTypeSymbol { get; } @@ -269,7 +270,7 @@ namespace MapTo return new MappedMember( property.Name, - property.GetTypeSymbol().ToString(), + property.GetTypeSymbol()?.ToString() ?? throw new InvalidOperationException(), ToQualifiedDisplayName(propertyType) ?? propertyType.Name, converterFullyQualifiedName, converterParameters.ToImmutableArray(), @@ -315,7 +316,9 @@ namespace MapTo property, namedType, isEnumerable, - (property as IPropertySymbol).IsReadOnly); +#pragma warning disable CS8602 + (property as IPropertySymbol).IsReadOnly); +#pragma warning restore CS8602 ; } diff --git a/src/BlueWest.MapTo/Sources/UpdateDataAttributeSource.cs b/src/BlueWest.MapTo/Sources/UpdateDataAttributeSource.cs index 1bf082c..9b04d4c 100644 --- a/src/BlueWest.MapTo/Sources/UpdateDataAttributeSource.cs +++ b/src/BlueWest.MapTo/Sources/UpdateDataAttributeSource.cs @@ -2,6 +2,9 @@ using static MapTo.Sources.Constants; namespace MapTo.Sources { + /// + /// UpdateData Attribute Source + /// public class UpdateDataAttributeSource { internal const string AttributeName = "UpdateData";