3
3
4
4
using System ;
5
5
using System . Collections . Generic ;
6
+ using System . Diagnostics . SymbolStore ;
6
7
using System . IO ;
7
8
using System . Linq ;
8
9
using System . Text ;
@@ -212,6 +213,18 @@ private void PortMissingCommentsForType(DocsType dTypeToUpdate)
212
213
Remarks = tsActualTypeToPort . Remarks
213
214
} ;
214
215
216
+ // delegates
217
+ foreach ( IntelliSenseXmlParam tsParam in tsTypeToPort . Params )
218
+ {
219
+ mc . Params . Add ( tsParam . Name , tsParam . Value ) ;
220
+ }
221
+
222
+ // type typeparams
223
+ foreach ( IntelliSenseXmlTypeParam tsTypeParam in tsTypeToPort . TypeParams )
224
+ {
225
+ mc . TypeParams . Add ( tsTypeParam . Name , tsTypeParam . Value ) ;
226
+ }
227
+
215
228
// Rare case where the base type or interface docs should be used
216
229
if ( tsTypeToPort . InheritDoc )
217
230
{
@@ -258,6 +271,16 @@ private void PortMissingCommentsForMember(DocsMember dMemberToUpdate)
258
271
mc . Property = GetPropertyValue ( tsMemberToPort . Value , tsMemberToPort . Returns ) ;
259
272
}
260
273
274
+ foreach ( IntelliSenseXmlParam tsParam in tsMemberToPort . Params )
275
+ {
276
+ mc . Params . Add ( tsParam . Name , tsParam . Value ) ;
277
+ }
278
+
279
+ foreach ( IntelliSenseXmlTypeParam tsTypeParam in tsMemberToPort . TypeParams )
280
+ {
281
+ mc . TypeParams . Add ( tsTypeParam . Name , tsTypeParam . Value ) ;
282
+ }
283
+
261
284
// Rare case where the base type or interface docs should be used,
262
285
// but only for elements that aren't explicitly documented in the actual API
263
286
if ( tsMemberToPort . InheritDoc )
@@ -313,7 +336,18 @@ private void GetMissingCommentsForTypeFromInheritDoc(MissingComments mc, DocsTyp
313
336
mc . Summary = tsInheritedMember . Summary ;
314
337
mc . Returns = tsInheritedMember . Returns ;
315
338
mc . Remarks = tsInheritedMember . Remarks ;
316
-
339
+
340
+ // delegates
341
+ foreach ( IntelliSenseXmlParam tsParam in tsInheritedMember . Params )
342
+ {
343
+ mc . Params . Add ( tsParam . Name , tsParam . Value ) ;
344
+ }
345
+
346
+ // type typeparams
347
+ foreach ( IntelliSenseXmlTypeParam tsTypeParam in tsInheritedMember . TypeParams )
348
+ {
349
+ mc . TypeParams . Add ( tsTypeParam . Name , tsTypeParam . Value ) ;
350
+ }
317
351
}
318
352
// Look for the base type from which this one inherits
319
353
else if ( DocsComments . Types . TryGetValue ( $ "T:{ dTypeToUpdate . BaseTypeName } ", out DocsType ? dBaseType ) &&
@@ -329,6 +363,18 @@ private void GetMissingCommentsForTypeFromInheritDoc(MissingComments mc, DocsTyp
329
363
mc . Summary = dBaseType . Summary ;
330
364
mc . Returns = dBaseType . Returns ;
331
365
mc . Remarks = dBaseType . Remarks ;
366
+
367
+ // delegates
368
+ foreach ( DocsParam tsParam in dBaseType . Params )
369
+ {
370
+ mc . Params . Add ( tsParam . Name , tsParam . Value ) ;
371
+ }
372
+
373
+ // type typeparams
374
+ foreach ( DocsTypeParam tsTypeParam in dBaseType . TypeParams )
375
+ {
376
+ mc . TypeParams . Add ( tsTypeParam . Name , tsTypeParam . Value ) ;
377
+ }
332
378
}
333
379
}
334
380
@@ -358,6 +404,22 @@ private void GetMissingCommentsForMemberFromInheritDoc(MissingComments mc, DocsM
358
404
{
359
405
mc . Property = GetPropertyValue ( tsInheritedMember . Value , tsInheritedMember . Returns ) ;
360
406
}
407
+
408
+ foreach ( IntelliSenseXmlParam tsParam in tsInheritedMember . Params )
409
+ {
410
+ if ( ! mc . Params . TryAdd ( tsParam . Name , tsParam . Value ) )
411
+ {
412
+ mc . Params [ tsParam . Name ] = tsParam . Value ;
413
+ }
414
+ }
415
+
416
+ foreach ( IntelliSenseXmlTypeParam tsTypeParam in tsInheritedMember . TypeParams )
417
+ {
418
+ if ( ! mc . TypeParams . TryAdd ( tsTypeParam . Name , tsTypeParam . Value ) )
419
+ {
420
+ mc . TypeParams [ tsTypeParam . Name ] = tsTypeParam . Value ;
421
+ }
422
+ }
361
423
}
362
424
// Look for the base type and find the member from which this one inherits
363
425
else if ( DocsComments . Types . TryGetValue ( $ "T:{ dMemberToUpdate . ParentType . BaseTypeName } ", out DocsType ? dBaseType ) &&
@@ -397,6 +459,22 @@ private void GetMissingCommentsForMemberFromInheritDoc(MissingComments mc, DocsM
397
459
{
398
460
mc . Property = GetPropertyValue ( dBaseMember . Value , dBaseMember . Returns ) ;
399
461
}
462
+
463
+ foreach ( DocsParam baseParam in dBaseMember . Params )
464
+ {
465
+ if ( ! mc . Params . TryAdd ( baseParam . Name , baseParam . Value ) )
466
+ {
467
+ mc . Params [ baseParam . Name ] = baseParam . Value ;
468
+ }
469
+ }
470
+
471
+ foreach ( DocsTypeParam baseTypeParam in dBaseMember . TypeParams )
472
+ {
473
+ if ( ! mc . TypeParams . TryAdd ( baseTypeParam . Name , baseTypeParam . Value ) )
474
+ {
475
+ mc . TypeParams [ baseTypeParam . Name ] = baseTypeParam . Value ;
476
+ }
477
+ }
400
478
}
401
479
}
402
480
}
@@ -413,13 +491,29 @@ private MissingComments GetMissingCommentsForMemberFromInterface(MissingComments
413
491
mc . Property = GetPropertyValue ( dInterfacedMember . Value , dInterfacedMember . Returns ) ;
414
492
}
415
493
494
+ foreach ( DocsParam interfaceParam in dInterfacedMember . Params )
495
+ {
496
+ if ( ! mc . Params . TryAdd ( interfaceParam . Name , interfaceParam . Value ) )
497
+ {
498
+ mc . Params [ interfaceParam . Name ] = interfaceParam . Value ;
499
+ }
500
+ }
501
+
502
+ foreach ( DocsTypeParam interfaceTypeParam in dInterfacedMember . TypeParams )
503
+ {
504
+ if ( ! mc . TypeParams . TryAdd ( interfaceTypeParam . Name , interfaceTypeParam . Value ) )
505
+ {
506
+ mc . TypeParams [ interfaceTypeParam . Name ] = interfaceTypeParam . Value ;
507
+ }
508
+ }
509
+
416
510
if ( ! dInterfacedMember . Remarks . IsDocsEmpty ( ) )
417
511
{
418
512
// Only attempt to port if the member name is the same as the interfaced member docid without prefix
419
- if ( dMemberToUpdate . MemberName == dInterfacedMember . DocId [ 2 .. ] )
513
+ if ( dMemberToUpdate . MemberName == dInterfacedMember . DocIdUnprefixed )
420
514
{
421
- string dMemberToUpdateTypeDocIdNoPrefix = dMemberToUpdate . ParentType . DocId [ 2 .. ] ;
422
- string interfacedMemberTypeDocIdNoPrefix = dInterfacedMember . ParentType . DocId [ 2 .. ] ;
515
+ string dMemberToUpdateTypeDocIdNoPrefix = dMemberToUpdate . ParentType . DocIdUnprefixed ;
516
+ string interfacedMemberTypeDocIdNoPrefix = dInterfacedMember . ParentType . DocIdUnprefixed ;
423
517
424
518
// Special text for EIIs in Remarks
425
519
string eiiMessage = $ "This member is an explicit interface member implementation. It can be used only when the <xref:{ dMemberToUpdateTypeDocIdNoPrefix } > instance is cast to an <xref:{ interfacedMemberTypeDocIdNoPrefix } > interface.";
@@ -840,7 +934,7 @@ private void TryPortMissingExceptionsForMember(DocsMember dMemberToUpdate, Intel
840
934
// First time adding the cref
841
935
if ( dException == null && Config . PortExceptionsNew )
842
936
{
843
- AddedExceptions . Add ( $ "Exception=[{ tsException . Cref } ] in Member=[{ dMemberToUpdate . DocId } ]") ;
937
+ AddedExceptions . Add ( $ "Exception=[{ tsException . Cref . AsEscapedDocId ( ) } ] in Member=[{ dMemberToUpdate . DocId } ]") ;
844
938
string text = XmlHelper . ReplaceExceptionPatterns ( XmlHelper . GetNodesInPlainText ( tsException . XEException ) ) ;
845
939
dException = dMemberToUpdate . AddException ( tsException . Cref , text ) ;
846
940
created = true ;
@@ -852,7 +946,7 @@ private void TryPortMissingExceptionsForMember(DocsMember dMemberToUpdate, Intel
852
946
string value = XmlHelper . ReplaceExceptionPatterns ( XmlHelper . GetNodesInPlainText ( formattedException ) ) ;
853
947
if ( ! dException . WordCountCollidesAboveThreshold ( value , Config . ExceptionCollisionThreshold ) )
854
948
{
855
- AddedExceptions . Add ( $ "Exception=[{ tsException . Cref } ] in Member=[{ dMemberToUpdate . DocId } ]") ;
949
+ AddedExceptions . Add ( $ "Exception=[{ tsException . Cref . AsEscapedDocId ( ) } ] in Member=[{ dMemberToUpdate . DocId } ]") ;
856
950
dException . AppendException ( value ) ;
857
951
created = true ;
858
952
}
@@ -886,7 +980,7 @@ private bool TryPromptParam(DocsParam oldDParam, IntelliSenseXmlMember tsMember,
886
980
int option = - 1 ;
887
981
while ( option == - 1 )
888
982
{
889
- Log . Error ( $ "Problem in param '{ oldDParam . Name } ' in member '{ tsMember . Name } ' in file '{ oldDParam . ParentAPI . FilePath } '") ;
983
+ Log . Error ( $ "Problem in param '{ oldDParam . Name } ' in member '{ tsMember . Name . AsEscapedDocId ( ) } ' in file '{ oldDParam . ParentAPI . FilePath } '") ;
890
984
Log . Error ( $ "The param probably exists in code, but the exact name was not found in Docs. What would you like to do?") ;
891
985
Log . Warning ( " 0 - Exit program." ) ;
892
986
Log . Info ( " 1 - Select the correct IntelliSense xml param from the existing ones." ) ;
@@ -915,7 +1009,7 @@ private bool TryPromptParam(DocsParam oldDParam, IntelliSenseXmlMember tsMember,
915
1009
int paramSelection = - 1 ;
916
1010
while ( paramSelection == - 1 )
917
1011
{
918
- Log . Info ( $ "IntelliSense xml params found in member '{ tsMember . Name } ':") ;
1012
+ Log . Info ( $ "IntelliSense xml params found in member '{ tsMember . Name . AsEscapedDocId ( ) } ':") ;
919
1013
Log . Warning ( " 0 - Exit program." ) ;
920
1014
Log . Info ( " 1 - Ignore this param and continue." ) ;
921
1015
int paramCounter = 2 ;
@@ -991,7 +1085,7 @@ private bool TryPromptTypeParam(DocsTypeParam oldDTypeParam, IntelliSenseXmlMemb
991
1085
int option = - 1 ;
992
1086
while ( option == - 1 )
993
1087
{
994
- Log . Error ( $ "Problem in typeparam '{ oldDTypeParam . Name } ' in member '{ tsMember . Name } ' in file '{ oldDTypeParam . ParentAPI . FilePath } '") ;
1088
+ Log . Error ( $ "Problem in typeparam '{ oldDTypeParam . Name } ' in member '{ tsMember . Name . AsEscapedDocId ( ) } ' in file '{ oldDTypeParam . ParentAPI . FilePath } '") ;
995
1089
Log . Error ( $ "The typeparam probably exists in code, but the exact name was not found in Docs. What would you like to do?") ;
996
1090
Log . Warning ( " 0 - Exit program." ) ;
997
1091
Log . Info ( " 1 - Select the correct IntelliSense xml typeparam from the existing ones." ) ;
@@ -1020,7 +1114,7 @@ private bool TryPromptTypeParam(DocsTypeParam oldDTypeParam, IntelliSenseXmlMemb
1020
1114
int typeParamSelection = - 1 ;
1021
1115
while ( typeParamSelection == - 1 )
1022
1116
{
1023
- Log . Info ( $ "IntelliSense xml typeparams found in member '{ tsMember . Name } ':") ;
1117
+ Log . Info ( $ "IntelliSense xml typeparams found in member '{ tsMember . Name . AsEscapedDocId ( ) } ':") ;
1024
1118
Log . Warning ( " 0 - Exit program." ) ;
1025
1119
Log . Info ( " 1 - Ignore this typeparam and continue." ) ;
1026
1120
int typeParamCounter = 2 ;
@@ -1216,7 +1310,7 @@ void TryPrintMember(ref bool undocMember, string memberDocId)
1216
1310
{
1217
1311
TryPrintMember ( ref undocMember , member . DocId ) ;
1218
1312
1219
- Log . Error ( $ " Member Exception: { exception . Cref } : { exception . Value } ") ;
1313
+ Log . Error ( $ " Member Exception: { exception . Cref . AsEscapedDocId ( ) } : { exception . Value } ") ;
1220
1314
exceptions ++ ;
1221
1315
}
1222
1316
}
@@ -1240,6 +1334,8 @@ private class MissingComments
1240
1334
internal string Returns { get ; set ; }
1241
1335
internal string Remarks { get ; set ; }
1242
1336
internal string Property { get ; set ; }
1337
+ internal Dictionary < string , string > Params { get ; }
1338
+ internal Dictionary < string , string > TypeParams { get ; }
1243
1339
internal bool IsEII { get ; set ; }
1244
1340
1245
1341
internal MissingComments ( )
@@ -1248,6 +1344,8 @@ internal MissingComments()
1248
1344
Returns = Configuration . ToBeAdded ;
1249
1345
Remarks = Configuration . ToBeAdded ;
1250
1346
Property = Configuration . ToBeAdded ;
1347
+ Params = new Dictionary < string , string > ( ) ;
1348
+ TypeParams = new Dictionary < string , string > ( ) ;
1251
1349
}
1252
1350
}
1253
1351
}
0 commit comments