8
8
using System ;
9
9
using System . Collections . Generic ;
10
10
using System . Linq ;
11
- using System . Reflection ;
12
11
using System . Threading ;
13
12
using System . Threading . Tasks ;
14
- using Xunit ;
15
13
using Xunit . Abstractions ;
16
14
17
15
namespace Microsoft . Diagnostics . Monitoring . TestCommon
@@ -80,7 +78,9 @@ public virtual async Task OnBeforeResumeAsync(IEndpointInfo endpointInfo, Cancel
80
78
{
81
79
if ( endpointInfo . RuntimeVersion . Major >= 8 && ! string . IsNullOrEmpty ( _startupHookPath ) )
82
80
{
83
- await ApplyStartupHookAsync ( new DiagnosticsClient ( endpointInfo . ProcessId ) , _startupHookPath , token ) ;
81
+ DiagnosticsClient client = new ( endpointInfo . ProcessId ) ;
82
+
83
+ await client . ApplyStartupHookAsync ( _startupHookPath , token ) ;
84
84
}
85
85
}
86
86
@@ -106,19 +106,6 @@ public Task OnRemovedEndpointInfoAsync(IEndpointInfo info, CancellationToken tok
106
106
token ) ;
107
107
}
108
108
109
- private static Task ApplyStartupHookAsync ( DiagnosticsClient client , string path , CancellationToken token )
110
- {
111
- // DiagnosticsClient.ApplyStartupHookAsync currently is not public
112
- MethodBase applyStartupHookAsync =
113
- typeof ( DiagnosticsClient ) . GetMethod (
114
- "ApplyStartupHookAsync" ,
115
- BindingFlags . Instance | BindingFlags . NonPublic ) ;
116
-
117
- Assert . NotNull ( applyStartupHookAsync ) ;
118
-
119
- return ( Task ) applyStartupHookAsync . Invoke ( client , new object [ ] { path , token } ) ;
120
- }
121
-
122
109
private static async Task < IEndpointInfo > WaitForCompletionAsync ( string operation , SemaphoreSlim semaphore , List < CompletionEntry > entries , ITestOutputHelper outputHelper , AppRunner runner , TimeSpan timeout )
123
110
{
124
111
CompletionEntry entry = new ( runner ) ;
0 commit comments