You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 18, 2018. It is now read-only.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
namespace WebApplication2
{
public class Program : IObserver<DiagnosticListener>, IObserver<KeyValuePair<string, object>>
{
public static void Main(string[] args)
{
new Program().MainImpl(args);
}
public void MainImpl(string[] args)
{
DiagnosticListener.AllListeners.Subscribe(this);
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseApplicationInsights()
.ConfigureLogging(f=>f.AddConsole(LogLevel.Debug))
.Build();
host.Start();
Task t;
using (var httpClient = new HttpClient())
{
t = httpClient.GetAsync("http://localhost:5000//")
.ContinueWith(task => { Console.WriteLine("Request done"); });
t.Wait();
}
Console.WriteLine("Before Dispose");
host.Dispose();
Console.WriteLine("After Dispose");
Console.ReadLine();
}
public void OnCompleted()
{
}
public void OnError(Exception error)
{
}
public void OnNext(KeyValuePair<string, object> value)
{
if (value.Key == "Microsoft.AspNetCore.Hosting.EndRequest")
{
Console.WriteLine(value.Key);
Thread.Sleep(3000);
Console.WriteLine("After Microsoft.AspNetCore.Hosting.EndRequest");
}
}
public void OnNext(DiagnosticListener value)
{
value.Subscribe(this);
}
}
}
After Microsoft.AspNetCore.Hosting.EndRequest is printed after After Dispose
The text was updated successfully, but these errors were encountered:
Repro:
After Microsoft.AspNetCore.Hosting.EndRequest
is printed afterAfter Dispose
The text was updated successfully, but these errors were encountered: