33
44using System ;
55using System . Collections . Generic ;
6+ using System . Diagnostics . CodeAnalysis ;
67using System . Globalization ;
78using System . Linq ;
89using System . Text ;
910using System . Threading ;
10- using System . Threading . Tasks ;
1111using System . Xml . Linq ;
1212
1313namespace Microsoft . VisualStudio . Threading
@@ -46,6 +46,7 @@ protected internal virtual SynchronizationContext NoMessagePumpSynchronizationCo
4646 /// Contributes data for a hang report.
4747 /// </summary>
4848 /// <returns>The hang report contribution. Null values should be ignored.</returns>
49+ [ RequiresUnreferencedCode ( Reasons . DiagnosticAnalysisOnly ) ]
4950 HangReportContribution IHangReportContributor . GetHangReport ( )
5051 {
5152 return this . GetHangReport ( ) ;
@@ -55,7 +56,8 @@ HangReportContribution IHangReportContributor.GetHangReport()
5556 /// Contributes data for a hang report.
5657 /// </summary>
5758 /// <returns>The hang report contribution. Null values should be ignored.</returns>
58- [ System . Diagnostics . CodeAnalysis . SuppressMessage ( "Microsoft.Maintainability" , "CA1502:AvoidExcessiveComplexity" ) , System . Diagnostics . CodeAnalysis . SuppressMessage ( "Microsoft.Maintainability" , "CA1502:AvoidExcessiveComplexity" ) ]
59+ [ SuppressMessage ( "Microsoft.Maintainability" , "CA1502:AvoidExcessiveComplexity" ) , SuppressMessage ( "Microsoft.Maintainability" , "CA1502:AvoidExcessiveComplexity" ) ]
60+ [ RequiresUnreferencedCode ( Reasons . DiagnosticAnalysisOnly ) ]
5961 protected virtual HangReportContribution GetHangReport ( )
6062 {
6163 using ( this . NoMessagePumpSynchronizationContext . Apply ( ) )
@@ -125,6 +127,7 @@ private static XDocument CreateDgml(out XElement nodes, out XElement links)
125127 /// <summary>
126128 /// Appends details of a given collection of awaiters to the hang report.
127129 /// </summary>
130+ [ RequiresUnreferencedCode ( Reasons . DiagnosticAnalysisOnly ) ]
128131 private static XElement CreateAwaiterNode ( Awaiter awaiter )
129132 {
130133 Requires . NotNull ( awaiter , nameof ( awaiter ) ) ;
@@ -211,9 +214,13 @@ public IEnumerable<string> Categories
211214 {
212215 get
213216 {
217+ #if NET
218+ foreach ( AwaiterCollection value in Enum . GetValues < AwaiterCollection > ( ) )
219+ #else
214220#pragma warning disable CS8605 // Unboxing a possibly null value.
215221 foreach ( AwaiterCollection value in Enum . GetValues ( typeof ( AwaiterCollection ) ) )
216222#pragma warning restore CS8605 // Unboxing a possibly null value.
223+ #endif
217224 {
218225 if ( this . Membership . HasFlag ( value ) )
219226 {
0 commit comments