You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnnewSourceGenDiagnostic(tds,DiagnosticsDescriptors.ErrorDuringCodeAnalysis,[type.ToMinimallyQualifiedDisplayString(),"Could not resolve discriminated union attribute type"]);
returnnewSourceGenDiagnostic(tds,DiagnosticsDescriptors.ErrorDuringCodeAnalysis,[type.ToMinimallyQualifiedDisplayString(),"Discriminated union attribute has TypeKind=Error"]);
returnnewSourceGenContext(newSourceGenError("Could not fetch type information for code generation of a discriminated union",tds));
163
+
returnnewSourceGenDiagnostic(tds,DiagnosticsDescriptors.ErrorDuringCodeAnalysis,[type.ToMinimallyQualifiedDisplayString(),"Could not fetch type information for code generation of a discriminated union"]);
returnnewSourceGenContext(newSourceGenError("Type of the member must be a named type or array type",tds));
174
+
returnnewSourceGenDiagnostic(tds,DiagnosticsDescriptors.ErrorDuringCodeAnalysis,[type.ToMinimallyQualifiedDisplayString(),$"The member type '{memberType.Name}' could not be resolved"]);
returnnewSourceGenContext(newSourceGenError("Type of the member must be a named type or array type",tds));
204
-
}
202
+
returnnewSourceGenDiagnostic(tds,DiagnosticsDescriptors.ErrorDuringGeneration,[type.ToMinimallyQualifiedDisplayString(),$"Could not build name for type '{memberType.Name}'. The type must be a named type, an array or a parameter but found '{memberType.GetType().FullName}'."]);
returnnewSourceGenContext(newSourceGenError("Ad-hoc union member name cannot be null or whitespace",tds));
208
+
returnnewSourceGenDiagnostic(tds,DiagnosticsDescriptors.ErrorDuringGeneration,[type.ToMinimallyQualifiedDisplayString(),$"The name for type '{memberType.Name}' must not be null nor empty."]);
Copy file name to clipboardExpand all lines: src/Thinktecture.Runtime.Extensions.SourceGenerator/CodeAnalysis/Diagnostics/ThinktectureRuntimeExtensionsAnalyzer.cs
+6-3Lines changed: 6 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -55,6 +55,11 @@ public sealed class ThinktectureRuntimeExtensionsAnalyzer : DiagnosticAnalyzer
Copy file name to clipboardExpand all lines: src/Thinktecture.Runtime.Extensions.SourceGenerator/CodeAnalysis/DiagnosticsDescriptors.cs
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,11 @@ internal static class DiagnosticsDescriptors
39
39
publicstaticreadonlyDiagnosticDescriptorAllowDefaultStructsCannotBeTrueIfSomeMembersDisallowDefaultValues=new("TTRESG058","'AllowDefaultStructs' must be 'false' if some members disallow default values","'AllowDefaultStructs' of type '{0}' must be 'false' because following members disallow default values: {1}",nameof(ThinktectureRuntimeExtensionsAnalyzer),DiagnosticSeverity.Error,true);
40
40
publicstaticreadonlyDiagnosticDescriptorObjectFactoryMustHaveCorrespondingConstructor=new("TTRESG059","Type with ObjectFactoryAttribute<T> and 'HasCorrespondingConstructor = true' must have a constructor with type 'T'","The type '{0}' with 'ObjectFactoryAttribute<{1}>' and 'HasCorrespondingConstructor = true' must have a constructor with a single argument of type '{1}'",nameof(ThinktectureRuntimeExtensionsAnalyzer),DiagnosticSeverity.Error,true);
41
41
publicstaticreadonlyDiagnosticDescriptorSmartEnumMustNotHaveObjectFactoryConstructor=new("TTRESG060","Smart Enums with ObjectFactoryAttribute<T> must not have 'HasCorrespondingConstructor' set to 'true'","Smart Enum '{0}' with 'ObjectFactoryAttribute<{1}>' must not have the property 'HasCorrespondingConstructor' set to 'true'",nameof(ThinktectureRuntimeExtensionsAnalyzer),DiagnosticSeverity.Error,true);
42
+
publicstaticreadonlyDiagnosticDescriptorTypeMustNotHaveMoveThanOneAttribute=new("TTRESG061","Type must not have more than one ValueObject/SmartEnum/Union-attribute","The type '{0}' must not have more than one ValueObject/SmartEnum/Union-attribute",nameof(ThinktectureRuntimeExtensionsAnalyzer),DiagnosticSeverity.Error,true);
43
+
publicstaticreadonlyDiagnosticDescriptorTypeMustNotHaveMoveThanOneSmartEnumAttribute=new("TTRESG062",$"Type must not have more than one {Constants.Attributes.SmartEnum.NAME}",$"The type '{{0}}' must not have more than one {Constants.Attributes.SmartEnum.NAME}",nameof(ThinktectureRuntimeExtensionsAnalyzer),DiagnosticSeverity.Error,true);
44
+
publicstaticreadonlyDiagnosticDescriptorTypeMustNotHaveMoveThanOneValueObjectAttribute=new("TTRESG063",$"Type must not have more than one {Constants.Attributes.ValueObject.KEYED_NAME}/{Constants.Attributes.ValueObject.COMPLEX_NAME}",$"The type '{{0}}' must not have more than one {Constants.Attributes.ValueObject.KEYED_NAME}/{Constants.Attributes.ValueObject.COMPLEX_NAME}",nameof(ThinktectureRuntimeExtensionsAnalyzer),DiagnosticSeverity.Error,true);
45
+
publicstaticreadonlyDiagnosticDescriptorTypeMustNotHaveMoveThanOneDiscriminatedUnionAttribute=new("TTRESG064",$"Type must not have more than one {Constants.Attributes.Union.NAME}/{Constants.Attributes.Union.NAME_AD_HOC}",$"The type '{{0}}' must not have more than one {Constants.Attributes.Union.NAME}/{Constants.Attributes.Union.NAME_AD_HOC}",nameof(ThinktectureRuntimeExtensionsAnalyzer),DiagnosticSeverity.Error,true);
46
+
publicstaticreadonlyDiagnosticDescriptorAdHocUnionMustHaveAtLeastTwoMemberTypes=new("TTRESG065","Ad hoc union must define at least two member types","Ad hoc union '{0}' must have at least two member types",nameof(ThinktectureRuntimeExtensionsAnalyzer),DiagnosticSeverity.Error,true);
42
47
43
48
publicstaticreadonlyDiagnosticDescriptorErrorDuringModulesAnalysis=new("TTRESG097","Error during analysis of referenced modules","Error during analysis of referenced modules: '{0}'",nameof(ThinktectureRuntimeExtensionsAnalyzer),DiagnosticSeverity.Error,true);
44
49
publicstaticreadonlyDiagnosticDescriptorErrorDuringCodeAnalysis=new("TTRESG098","Error during code analysis","Error during code analysis of '{0}': '{1}'",nameof(ThinktectureRuntimeExtensionsAnalyzer),DiagnosticSeverity.Warning,true);
0 commit comments