@@ -35,7 +35,7 @@ internal XmlParser(XDoc source, Assembly assembly, XmlDocument xml)
3535 . GetTypes ( )
3636 . Where ( t => ! string . IsNullOrWhiteSpace ( t . FullName ) )
3737 . ToFrozenDictionary (
38- t => t . FullName ! . Replace ( '+' , '.' ) , // Replace nested type '+' with '.'
38+ t => ConvertToXmlDocTypeFormat ( t . FullName ! ) ,
3939 t => t
4040 ) ;
4141
@@ -225,17 +225,17 @@ private static string GetTypeFriendlyName(Type type)
225225 {
226226 if ( ! type . IsGenericType )
227227 {
228- return type . FullName ?? "" ;
228+ return ConvertToXmlDocTypeFormat ( type . FullName ) ;
229229 }
230230
231231 // Get the name of the generic type definition (e.g. System.Nullable`1)
232232 var genericTypeDefinition = type . GetGenericTypeDefinition ( ) ;
233- var typeName = genericTypeDefinition . FullName ;
233+ var typeName = ConvertToXmlDocTypeFormat ( genericTypeDefinition . FullName ) ;
234234
235235 // Remove the `1 from the generic type name
236236 if ( IsGeneric ( typeName ) )
237237 {
238- var indexOfStartGenericParameter = typeName ! . IndexOf ( '`' ) ;
238+ var indexOfStartGenericParameter = typeName . IndexOf ( '`' ) ;
239239
240240 typeName = typeName [ ..indexOfStartGenericParameter ] ;
241241 }
@@ -265,4 +265,28 @@ private TypeDocumentation ResolveTypeDocumentation(Type type)
265265
266266 return result ;
267267 }
268+
269+ /// <summary>
270+ /// Converts a nested class name to XML documentation notation format.
271+ /// </summary>
272+ /// <param name="className">The full name of the class, potentially containing nested class notation.</param>
273+ /// <returns>
274+ /// A string with '+' characters (used for nested classes in .NET) replaced
275+ /// with '.' characters (used in XML documentation).
276+ /// </returns>
277+ /// <remarks>
278+ /// In .NET, nested classes are represented in reflection with '+' characters,
279+ /// but in XML documentation, they use '.' notation.
280+ /// </remarks>
281+ private static string ConvertToXmlDocTypeFormat ( string ? className )
282+ {
283+ if ( string . IsNullOrWhiteSpace ( className ) )
284+ {
285+ //Generic types has no FullName value
286+ return string . Empty ;
287+ }
288+
289+ // Replace nested type '+' with '.' if needed
290+ return className . Replace ( '+' , '.' ) ;
291+ }
268292}
0 commit comments