コード例 #1
0
        public async Task WaitForConnectionTest()
        {
            using TestRunner runner = new TestRunner(CommonHelper.GetTraceePathWithArgs(), output);
            runner.Start(timeoutInMSPipeCreation: 3000);
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                Thread.Sleep(5000);
            }

            var client = new DiagnosticsClient(runner.Pid);

            using var timeoutSource = new CancellationTokenSource(TimeSpan.FromMilliseconds(250));
            try
            {
                await client.WaitForConnectionAsync(timeoutSource.Token);
            }
            finally
            {
                runner.Stop();
            }
        }