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
Causality is lost when Task.Run is used. This makes sense but I wonder if it's possible to stitch the async stacks in this case. Here's the code:
using System;using System.Collections.Generic;using System.Linq;using System.Threading.Tasks;using Microsoft.AspNetCore.Builder;using Microsoft.AspNetCore.Hosting;using Microsoft.AspNetCore.Http;using Microsoft.Extensions.DependencyInjection;using Microsoft.Extensions.Hosting;namespaceWebApplication352{publicclassStartup{// This method gets called by the runtime. Use this method to add services to the container.// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940publicvoidConfigureServices(IServiceCollectionservices){}// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.publicvoidConfigure(IApplicationBuilderapp,IWebHostEnvironmentenv){if(env.IsDevelopment()){
app.UseDeveloperExceptionPage();}
app.UseRouting();
app.UseEndpoints(endpoints =>{ endpoints.MapGet("/",async context =>{await Task.Run(async()=>{await Task.Delay(10000);await context.Response.WriteAsync("Hello World!");});});});}}}
I've rewritten dumpasync in C# and I've addressed this as well (or at least the simpler repro successfully connects the stacks... I didn't try the original).
Causality is lost when
Task.Run
is used. This makes sense but I wonder if it's possible to stitch the async stacks in this case. Here's the code:This is what
dumpasync -stacks
looks like:cc @stephentoub
The text was updated successfully, but these errors were encountered: