diff --git a/src/Thinktecture.Runtime.Extensions.SourceGenerator/CodeAnalysis/Diagnostics/ThinktectureRuntimeExtensionsAnalyzer.cs b/src/Thinktecture.Runtime.Extensions.SourceGenerator/CodeAnalysis/Diagnostics/ThinktectureRuntimeExtensionsAnalyzer.cs index 15d7b8ee..199e0cfe 100644 --- a/src/Thinktecture.Runtime.Extensions.SourceGenerator/CodeAnalysis/Diagnostics/ThinktectureRuntimeExtensionsAnalyzer.cs +++ b/src/Thinktecture.Runtime.Extensions.SourceGenerator/CodeAnalysis/Diagnostics/ThinktectureRuntimeExtensionsAnalyzer.cs @@ -238,7 +238,7 @@ private static void AnalyzeSmartEnum(OperationAnalysisContext context) { context.ReportDiagnostic(Diagnostic.Create(DiagnosticsDescriptors.ErrorDuringCodeAnalysis, Location.None, - type.ToFullyQualifiedDisplayString(), ex.Message)); + type.ToFullyQualifiedDisplayString(), ex.ToString())); } } @@ -274,7 +274,7 @@ private static void AnalyzeValueObject(OperationAnalysisContext context) { context.ReportDiagnostic(Diagnostic.Create(DiagnosticsDescriptors.ErrorDuringCodeAnalysis, Location.None, - type.ToFullyQualifiedDisplayString(), ex.Message)); + type.ToFullyQualifiedDisplayString(), ex.ToString())); } } @@ -302,7 +302,7 @@ private static void AnalyzeUnion(OperationAnalysisContext context) { context.ReportDiagnostic(Diagnostic.Create(DiagnosticsDescriptors.ErrorDuringCodeAnalysis, Location.None, - type.ToFullyQualifiedDisplayString(), ex.Message)); + type.ToFullyQualifiedDisplayString(), ex.ToString())); } } diff --git a/src/Thinktecture.Runtime.Extensions.SourceGenerator/CodeAnalysis/TypedMemberStateFactory.cs b/src/Thinktecture.Runtime.Extensions.SourceGenerator/CodeAnalysis/TypedMemberStateFactory.cs index ef95a07d..d420c6f8 100644 --- a/src/Thinktecture.Runtime.Extensions.SourceGenerator/CodeAnalysis/TypedMemberStateFactory.cs +++ b/src/Thinktecture.Runtime.Extensions.SourceGenerator/CodeAnalysis/TypedMemberStateFactory.cs @@ -124,7 +124,8 @@ public ITypedMemberState Create(ITypeSymbol type) SpecialType.System_Double => _double, SpecialType.System_String => _string, SpecialType.System_DateTime => _dateTime, - _ => _statesByTokens.TryGetValue((type.ContainingModule.MetadataName, type.MetadataToken), out var states) ? states : default + // Array types have no ContainingModule + _ => _statesByTokens.TryGetValue((type.ContainingModule?.MetadataName ?? "<>", type.MetadataToken), out var states) ? states : default }; if (cachedStates == default) diff --git a/test/Thinktecture.Runtime.Extensions.Tests.Shared/TestEnums/TestEnumWithArrayType.cs b/test/Thinktecture.Runtime.Extensions.Tests.Shared/TestEnums/TestEnumWithArrayType.cs new file mode 100644 index 00000000..e9324dcf --- /dev/null +++ b/test/Thinktecture.Runtime.Extensions.Tests.Shared/TestEnums/TestEnumWithArrayType.cs @@ -0,0 +1,9 @@ +namespace Thinktecture.Runtime.Tests.TestEnums; + +[SmartEnum] +public partial class TestEnumWithArrayType +{ + private static readonly TestEnumWithArrayType[] InternalMaritalStatusWithPartner = []; + + public static readonly TestEnumWithArrayType Item = new(1); +}