@@ -1113,13 +1113,13 @@ public static ImmutableArray<MemberDeclarationSyntax> GetOnPropertyChangeMethods
1113
1113
/// <summary>
1114
1114
/// Gets a <see cref="CompilationUnitSyntax"/> instance with the cached args of a specified type.
1115
1115
/// </summary>
1116
- /// <param name="ContainingTypeName ">The name of the generated type.</param>
1117
- /// <param name="ArgsTypeName ">The argument type name.</param>
1116
+ /// <param name="containingTypeName ">The name of the generated type.</param>
1117
+ /// <param name="argsTypeName ">The argument type name.</param>
1118
1118
/// <param name="names">The sequence of property names to cache args for.</param>
1119
1119
/// <returns>A <see cref="CompilationUnitSyntax"/> instance with the sequence of cached args, if any.</returns>
1120
1120
private static CompilationUnitSyntax ? GetKnownPropertyChangingOrChangedArgsSyntax (
1121
- string ContainingTypeName ,
1122
- string ArgsTypeName ,
1121
+ string containingTypeName ,
1122
+ string argsTypeName ,
1123
1123
ImmutableArray < string > names )
1124
1124
{
1125
1125
if ( names . IsEmpty )
@@ -1134,6 +1134,10 @@ public static ImmutableArray<MemberDeclarationSyntax> GetOnPropertyChangeMethods
1134
1134
// #nullable enable
1135
1135
// namespace CommunityToolkit.Mvvm.ComponentModel.__Internals
1136
1136
// {
1137
+ // /// <summary>
1138
+ // /// A helper type providing cached, reusable <see cref="<ARGS_TYPE_NAME>"/> instances
1139
+ // /// for all properties generated with <see cref="global::CommunityToolkit.Mvvm.ComponentModel.ObservablePropertyAttribute"/>.
1140
+ // /// </summary>
1137
1141
// [global::System.CodeDom.Compiler.GeneratedCode("...", "...")]
1138
1142
// [global::System.Diagnostics.DebuggerNonUserCode]
1139
1143
// [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
@@ -1150,14 +1154,19 @@ public static ImmutableArray<MemberDeclarationSyntax> GetOnPropertyChangeMethods
1150
1154
Comment ( "// <auto-generated/>" ) ,
1151
1155
Trivia ( PragmaWarningDirectiveTrivia ( Token ( SyntaxKind . DisableKeyword ) , true ) ) ,
1152
1156
Trivia ( NullableDirectiveTrivia ( Token ( SyntaxKind . EnableKeyword ) , true ) ) ) ) . AddMembers (
1153
- ClassDeclaration ( ContainingTypeName ) . AddModifiers (
1157
+ ClassDeclaration ( containingTypeName ) . AddModifiers (
1154
1158
Token ( SyntaxKind . InternalKeyword ) ,
1155
1159
Token ( SyntaxKind . StaticKeyword ) ) . AddAttributeLists (
1156
1160
AttributeList ( SingletonSeparatedList (
1157
1161
Attribute ( IdentifierName ( $ "global::System.CodeDom.Compiler.GeneratedCode") )
1158
1162
. AddArgumentListArguments (
1159
1163
AttributeArgument ( LiteralExpression ( SyntaxKind . StringLiteralExpression , Literal ( typeof ( ObservablePropertyGenerator ) . FullName ) ) ) ,
1160
- AttributeArgument ( LiteralExpression ( SyntaxKind . StringLiteralExpression , Literal ( typeof ( ObservablePropertyGenerator ) . Assembly . GetName ( ) . Version . ToString ( ) ) ) ) ) ) ) ,
1164
+ AttributeArgument ( LiteralExpression ( SyntaxKind . StringLiteralExpression , Literal ( typeof ( ObservablePropertyGenerator ) . Assembly . GetName ( ) . Version . ToString ( ) ) ) ) ) ) )
1165
+ . WithOpenBracketToken ( Token ( TriviaList (
1166
+ Comment ( "/// <summary>" ) ,
1167
+ Comment ( $ "/// A helper type providing cached, reusable <see cref=\" { argsTypeName } \" /> instances") ,
1168
+ Comment ( "/// for all properties generated with <see cref=\" global::CommunityToolkit.Mvvm.ComponentModel.ObservablePropertyAttribute\" />." ) ,
1169
+ Comment ( "/// </summary>" ) ) , SyntaxKind . OpenBracketToken , TriviaList ( ) ) ) ,
1161
1170
AttributeList ( SingletonSeparatedList ( Attribute ( IdentifierName ( "global::System.Diagnostics.DebuggerNonUserCode" ) ) ) ) ,
1162
1171
AttributeList ( SingletonSeparatedList ( Attribute ( IdentifierName ( "global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage" ) ) ) ) ,
1163
1172
AttributeList ( SingletonSeparatedList (
@@ -1168,31 +1177,32 @@ public static ImmutableArray<MemberDeclarationSyntax> GetOnPropertyChangeMethods
1168
1177
AttributeArgument ( LiteralExpression (
1169
1178
SyntaxKind . StringLiteralExpression ,
1170
1179
Literal ( "This type is not intended to be used directly by user code" ) ) ) ) ) ) )
1171
- . AddMembers ( names . Select ( name => CreateFieldDeclaration ( ArgsTypeName , name ) ) . ToArray ( ) ) ) )
1180
+ . AddMembers ( names . Select ( name => CreateFieldDeclaration ( argsTypeName , name ) ) . ToArray ( ) ) ) )
1172
1181
. NormalizeWhitespace ( ) ;
1173
1182
}
1174
1183
1175
1184
/// <summary>
1176
1185
/// Creates a field declaration for a cached property changing/changed name.
1177
1186
/// </summary>
1178
- /// <param name="typeName ">The field type name (either <see cref="PropertyChangedEventArgs"/> or <see cref="PropertyChangingEventArgs"/>).</param>
1187
+ /// <param name="fullyQualifiedTypeName ">The field fully qualified type name (either <see cref="PropertyChangedEventArgs"/> or <see cref="PropertyChangingEventArgs"/>).</param>
1179
1188
/// <param name="propertyName">The name of the cached property name.</param>
1180
1189
/// <returns>A <see cref="FieldDeclarationSyntax"/> instance for the input cached property name.</returns>
1181
- private static FieldDeclarationSyntax CreateFieldDeclaration ( string typeName , string propertyName )
1190
+ private static FieldDeclarationSyntax CreateFieldDeclaration ( string fullyQualifiedTypeName , string propertyName )
1182
1191
{
1183
1192
// Create a static field with a cached property changed/changing argument for a specified property.
1184
1193
// This code produces a field declaration as follows:
1185
1194
//
1195
+ // /// <summary>The cached <see cref="<TYPE_NAME>"/> instance for all "<PROPERTY_NAME>" generated properties.</summary>
1186
1196
// [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
1187
1197
// [global::System.Obsolete("This field is not intended to be referenced directly by user code")]
1188
1198
// public static readonly <ARG_TYPE> <PROPERTY_NAME> = new("<PROPERTY_NAME>");
1189
1199
return
1190
1200
FieldDeclaration (
1191
- VariableDeclaration ( IdentifierName ( typeName ) )
1201
+ VariableDeclaration ( IdentifierName ( fullyQualifiedTypeName ) )
1192
1202
. AddVariables (
1193
1203
VariableDeclarator ( Identifier ( propertyName ) )
1194
1204
. WithInitializer ( EqualsValueClause (
1195
- ObjectCreationExpression ( IdentifierName ( typeName ) )
1205
+ ObjectCreationExpression ( IdentifierName ( fullyQualifiedTypeName ) )
1196
1206
. AddArgumentListArguments ( Argument (
1197
1207
LiteralExpression ( SyntaxKind . StringLiteralExpression , Literal ( propertyName ) ) ) ) ) ) ) )
1198
1208
. AddModifiers (
@@ -1202,7 +1212,10 @@ private static FieldDeclarationSyntax CreateFieldDeclaration(string typeName, st
1202
1212
. AddAttributeLists (
1203
1213
AttributeList ( SingletonSeparatedList (
1204
1214
Attribute ( IdentifierName ( "global::System.ComponentModel.EditorBrowsable" ) ) . AddArgumentListArguments (
1205
- AttributeArgument ( ParseExpression ( "global::System.ComponentModel.EditorBrowsableState.Never" ) ) ) ) ) ,
1215
+ AttributeArgument ( ParseExpression ( "global::System.ComponentModel.EditorBrowsableState.Never" ) ) ) ) )
1216
+ . WithOpenBracketToken ( Token ( TriviaList (
1217
+ Comment ( $ "/// <summary>The cached <see cref=\" { fullyQualifiedTypeName } \" /> instance for all \" { propertyName } \" generated properties.</summary>") ) ,
1218
+ SyntaxKind . OpenBracketToken , TriviaList ( ) ) ) ,
1206
1219
AttributeList ( SingletonSeparatedList (
1207
1220
Attribute ( IdentifierName ( "global::System.Obsolete" ) ) . AddArgumentListArguments (
1208
1221
AttributeArgument ( LiteralExpression (
0 commit comments