Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

StackOverflowException at request middleware #6410

Closed
villawad-es opened this issue Jun 19, 2017 · 32 comments
Closed

StackOverflowException at request middleware #6410

villawad-es opened this issue Jun 19, 2017 · 32 comments

Comments

@villawad-es
Copy link

I'm experimenting a StackOverflowException at the end of request middleware, I can't understand what's happening.. so simple meddleware and no exception details...

Only exception not null info is:
HResult -2147023895 int
_COMPlusExceptionCode -532462766 int

image

@davidfowl
Copy link
Member

Your code has a stack overflow... Look at the callstack to see what is being repeated...

@villawad-es
Copy link
Author

How could I have a stack overflow under a request handler? only should go throw one time per request. Don't really understand.
I have been working on this issue for many time, and I didnt found anything wrong on my code that solve the problem, I have been working too with a Microsoft Azure Support engineer, and we couldent find anything toguether, he have recommend me to open this issue here, to find a quick support about this

@rynowak
Copy link
Member

rynowak commented Jun 19, 2017

So, what's in the call stack?

@villawad-es
Copy link
Author

villawad-es commented Jun 19, 2017

Here is the call stack, nothing on it

image

@davidfowl
Copy link
Member

davidfowl commented Jun 19, 2017

Can you expand the external code? (click Show External Code)

@davidfowl
Copy link
Member

image

@villawad-es
Copy link
Author

villawad-es commented Jun 19, 2017

Here it is

[Lightweight Function]	
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(System.Type serviceType)	Unknown
 	Microsoft.Extensions.DependencyInjection.Abstractions.dll!Microsoft.Extensions.Internal.ActivatorUtilities.GetService(System.IServiceProvider sp, System.Type type, System.Type requiredBy, bool isDefaultParameterRequired)	Unknown
 	[Lightweight Function]	
 	Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Internal.TypeActivatorCache.CreateInstance<object>(System.IServiceProvider serviceProvider, System.Type implementationType)	Unknown
 	Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Controllers.DefaultControllerActivator.Create(Microsoft.AspNetCore.Mvc.ControllerContext controllerContext)	Unknown
 	Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Controllers.DefaultControllerFactory.CreateController(Microsoft.AspNetCore.Mvc.ControllerContext context)	Unknown
 	Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(ref Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.State next, ref Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Scope scope, ref object state, ref bool isCompleted)	Unknown
 	Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextResourceFilter()	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextResourceFilter>d__22>(ref Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextResourceFilter>d__22 stateMachine)	Unknown
 	Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextResourceFilter()	Unknown
 	Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(ref Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.State next, ref Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Scope scope, ref object state, ref bool isCompleted)	Unknown
 	Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeAsync()	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAsync>d__20>(ref Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAsync>d__20 stateMachine)	Unknown
 	Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeAsync()	Unknown
 	Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Internal.MvcAttributeRouteHandler.RouteAsync.AnonymousMethod__0(Microsoft.AspNetCore.Http.HttpContext c)	Unknown
 	Microsoft.AspNetCore.Routing.dll!Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext httpContext)	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4>(ref Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4 stateMachine)	Unknown
 	Microsoft.AspNetCore.Routing.dll!Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext httpContext)	Unknown
 	Microsoft.AspNetCore.Authentication.dll!Microsoft.AspNetCore.Authentication.AuthenticationMiddleware<Microsoft.AspNetCore.Builder.CookieAuthenticationOptions>.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.AspNetCore.Authentication.AuthenticationMiddleware<Microsoft.AspNetCore.Builder.CookieAuthenticationOptions>.<Invoke>d__18>(ref Microsoft.AspNetCore.Authentication.AuthenticationMiddleware<Microsoft.AspNetCore.Builder.CookieAuthenticationOptions>.<Invoke>d__18 stateMachine)	Unknown
 	Microsoft.AspNetCore.Authentication.dll!Microsoft.AspNetCore.Authentication.AuthenticationMiddleware<Microsoft.AspNetCore.Builder.CookieAuthenticationOptions>.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	Microsoft.AspNetCore.Authentication.dll!Microsoft.AspNetCore.Authentication.AuthenticationMiddleware<Microsoft.AspNetCore.Builder.CookieAuthenticationOptions>.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.AspNetCore.Authentication.AuthenticationMiddleware<Microsoft.AspNetCore.Builder.CookieAuthenticationOptions>.<Invoke>d__18>(ref Microsoft.AspNetCore.Authentication.AuthenticationMiddleware<Microsoft.AspNetCore.Builder.CookieAuthenticationOptions>.<Invoke>d__18 stateMachine)	Unknown
 	Microsoft.AspNetCore.Authentication.dll!Microsoft.AspNetCore.Authentication.AuthenticationMiddleware<Microsoft.AspNetCore.Builder.CookieAuthenticationOptions>.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	Microsoft.AspNetCore.Authentication.dll!Microsoft.AspNetCore.Authentication.AuthenticationMiddleware<Microsoft.AspNetCore.Builder.CookieAuthenticationOptions>.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.AspNetCore.Authentication.AuthenticationMiddleware<Microsoft.AspNetCore.Builder.CookieAuthenticationOptions>.<Invoke>d__18>(ref Microsoft.AspNetCore.Authentication.AuthenticationMiddleware<Microsoft.AspNetCore.Builder.CookieAuthenticationOptions>.<Invoke>d__18 stateMachine)	Unknown
 	Microsoft.AspNetCore.Authentication.dll!Microsoft.AspNetCore.Authentication.AuthenticationMiddleware<Microsoft.AspNetCore.Builder.CookieAuthenticationOptions>.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	Microsoft.AspNetCore.Authentication.dll!Microsoft.AspNetCore.Authentication.AuthenticationMiddleware<Microsoft.AspNetCore.Builder.CookieAuthenticationOptions>.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.AspNetCore.Authentication.AuthenticationMiddleware<Microsoft.AspNetCore.Builder.CookieAuthenticationOptions>.<Invoke>d__18>(ref Microsoft.AspNetCore.Authentication.AuthenticationMiddleware<Microsoft.AspNetCore.Builder.CookieAuthenticationOptions>.<Invoke>d__18 stateMachine)	Unknown
 	Microsoft.AspNetCore.Authentication.dll!Microsoft.AspNetCore.Authentication.AuthenticationMiddleware<Microsoft.AspNetCore.Builder.CookieAuthenticationOptions>.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	Microsoft.AspNetCore.StaticFiles.dll!Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	Microsoft.AspNetCore.Diagnostics.dll!Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.<Invoke>d__3>(ref Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.<Invoke>d__3 stateMachine)	Unknown
 	Microsoft.AspNetCore.Diagnostics.dll!Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
>	OpenSession.Services.dll!OpenSession.Services.Middleware.TenantMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext httpContext) Line 84	C#
 	Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.dll!Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.<Invoke>d__5>(ref Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.<Invoke>d__5 stateMachine)	Unknown
 	Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.dll!Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.dll!Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.<Invoke>d__6>(ref Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.<Invoke>d__6 stateMachine)	Unknown
 	Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.dll!Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	Microsoft.AspNetCore.Diagnostics.dll!Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7>(ref Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7 stateMachine)	Unknown
 	Microsoft.AspNetCore.Diagnostics.dll!Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext httpContext)	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3>(ref Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3 stateMachine)	Unknown
 	Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext httpContext)	Unknown
 	Microsoft.AspNetCore.Hosting.dll!Microsoft.AspNetCore.Hosting.Internal.HostingApplication.ProcessRequestAsync(Microsoft.AspNetCore.Hosting.Internal.HostingApplication.Context context)	Unknown
 	Microsoft.AspNetCore.Server.Kestrel.dll!Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame<Microsoft.AspNetCore.Hosting.Internal.HostingApplication.Context>.RequestProcessingAsync()	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(object stateMachine)	Unknown
 	mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.OutputAsyncCausalityEvents.AnonymousMethod__0()	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()	Unknown
 	Microsoft.AspNetCore.Server.Kestrel.dll!Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure.LoggingThreadPool.RunAction.AnonymousMethod__5_0(object o)	Unknown
 	mscorlib.dll!System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(object state)	Unknown
 	mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
 	mscorlib.dll!System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()	Unknown
 	mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()	Unknown
 	mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()	Unknown

@davidfowl
Copy link
Member

@villawad-es What does your controller look like?

@villawad-es
Copy link
Author

image

image

image

@davidfowl
Copy link
Member

@villawad-es When did the stack overflow start? Did you try removing big pieces of your code until the stack overflow goes away? That might help narrow down which part of the code is causing issues.

@rynowak
Copy link
Member

rynowak commented Jun 19, 2017

Looking at:

Microsoft.AspNetCore.StaticFiles.dll!Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	Microsoft.AspNetCore.Diagnostics.dll!Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.<Invoke>d__3>(ref Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.<Invoke>d__3 stateMachine)	Unknown
 	Microsoft.AspNetCore.Diagnostics.dll!Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext context)	Unknown
>	OpenSession.Services.dll!OpenSession.Services.Middleware.TenantMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext httpContext) Line 84	C#

Are you using the status code middleware to execute an error handler?

@villawad-es
Copy link
Author

@rynowak I'm using the Exception Handler provided by the framework to set custom error pages

@villawad-es
Copy link
Author

villawad-es commented Jun 20, 2017

@davidfowl I have tried without much success, the error sometimes happens once the request is completed and the response has been received. I have migrated the application to the latest stable version of the core and the only thing that has changed is the way the error is displayed. The stack overflow started when I migrate the application from aspnet 5 to netcore 1.0

@davidfowl
Copy link
Member

@villawad-es if you can, provide us with a trimmed down version of your application that reproduces the issue and put it on github.

@Eilon
Copy link
Contributor

Eilon commented Jul 3, 2017

Closing because there is not enough information to reproduce this problem.

@Eilon Eilon closed this as completed Jul 3, 2017
@alohaninja
Copy link

alohaninja commented Jul 21, 2017

we just started receiving this same issue with our middleware in .net core ... hope someone has an idea where this is coming from - definitely not obvious as the callstack is empty. Spent 6 hours diagnosing so far - no dice and easy to reproduce.

@davidfowl
Copy link
Member

@alohaninja If you can provide a repro that would be great. A stack trace and the app code would be great first steps.

@alohaninja
Copy link

alohaninja commented Jul 21, 2017

Hi @davidfowl - we don't have a lite version of our app for immediate sharing, so this may take some time to put together a simpler SLN to demonstrate. Here is the stack trace once I disabled "Just-my-code" and downloaded .NET Source Symbols...not sure how helpful it is. I stepped through the JwtBearerEvents.OnTokenValidated middleware event and it was only called 5-6 times for different requests on the page. Suspect something in either Authorization or DI.

[Lightweight Function]	
Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(System.Type serviceType)	Unknown
Microsoft.Extensions.DependencyInjection.Abstractions.dll!Microsoft.Extensions.Internal.ActivatorUtilities.GetService(System.IServiceProvider sp, System.Type type = {Name = Inspecting the state of an object in the debuggee of type System.Type is not supported in this context. FullName = Inspecting the state of an object in the debuggee of type System.Type is not supported in this context.}, System.Type requiredBy = {Name = Inspecting the state of an object in the debuggee of type System.Type is not supported in this context. FullName = Inspecting the state of an object in the debuggee of type System.Type is not supported in this context.}, bool isDefaultParameterRequired = false)	Unknown
[Lightweight Function]	
Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Internal.TypeActivatorCache.CreateInstance<object>(System.IServiceProvider serviceProvider, System.Type implementationType)	Unknown
Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Controllers.DefaultControllerActivator.Create(Microsoft.AspNetCore.Mvc.ControllerContext controllerContext)	Unknown
Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Controllers.DefaultControllerFactory.CreateController(Microsoft.AspNetCore.Mvc.ControllerContext context = {Microsoft.AspNetCore.Mvc.ControllerContext})	Unknown
Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(ref Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.State next = InvokeBegin, ref Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Scope scope = Invoker, ref object state = {Microsoft.AspNetCore.Mvc.Authorization.AuthorizeFilter}, ref bool isCompleted = false)	Unknown
Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeAsync()	Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAsync>d__20>(ref Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAsync>d__20 stateMachine)	Unknown
Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeAsync()	Unknown
Microsoft.AspNetCore.Mvc.Core.dll!Microsoft.AspNetCore.Mvc.Internal.MvcAttributeRouteHandler.RouteAsync.AnonymousMethod__0(Microsoft.AspNetCore.Http.HttpContext c)	Unknown
Microsoft.AspNetCore.Routing.dll!Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext httpContext = {Microsoft.AspNetCore.Http.DefaultHttpContext})	Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4>(ref Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4 stateMachine)	Unknown
Microsoft.AspNetCore.Routing.dll!Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext httpContext)	Unknown
Microsoft.AspNetCore.Authentication.dll!Microsoft.AspNetCore.Authentication.AuthenticationMiddleware<Microsoft.AspNetCore.Builder.JwtBearerOptions>.Invoke(Microsoft.AspNetCore.Http.HttpContext context = {Microsoft.AspNetCore.Http.DefaultHttpContext})	Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(object stateMachine)	Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()	Unknown
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__0()	Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()	Unknown
mscorlib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining, ref System.Threading.Tasks.Task currentTask = null)	Unknown
mscorlib.dll!System.Threading.Tasks.Task.FinishContinuations()	Unknown
mscorlib.dll!System.Threading.Tasks.Task.FinishStageThree()	Unknown
mscorlib.dll!System.Threading.Tasks.Task<System.Threading.Tasks.VoidTaskResult>.TrySetResult(System.Threading.Tasks.VoidTaskResult result)	Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.SetResult(System.Threading.Tasks.VoidTaskResult result)	Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()	Unknown
Microsoft.AspNetCore.Authentication.dll!Microsoft.AspNetCore.Authentication.AuthenticationHandler<Microsoft.AspNetCore.Builder.JwtBearerOptions>.InitializeAsync(Microsoft.AspNetCore.Builder.JwtBearerOptions options, Microsoft.AspNetCore.Http.HttpContext context, Microsoft.Extensions.Logging.ILogger logger, System.Text.Encodings.Web.UrlEncoder encoder)	Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(object stateMachine)	Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()	Unknown
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__0()	Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()	Unknown
mscorlib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining, ref System.Threading.Tasks.Task currentTask = null)	Unknown
mscorlib.dll!System.Threading.Tasks.Task.FinishContinuations()	Unknown
mscorlib.dll!System.Threading.Tasks.Task.FinishStageThree()	Unknown
mscorlib.dll!System.Threading.Tasks.Task<System.__Canon>.TrySetResult(System.__Canon result)	Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<Microsoft.AspNetCore.Authentication.AuthenticateResult>.SetResult(Microsoft.AspNetCore.Authentication.AuthenticateResult result)	Unknown
Microsoft.AspNetCore.Authentication.JwtBearer.dll!Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()	Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(object stateMachine)	Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()	Unknown
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__0()	Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke()	Unknown
mscorlib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining, ref System.Threading.Tasks.Task currentTask = null)	Unknown
mscorlib.dll!System.Threading.Tasks.Task.FinishContinuations()	Unknown
mscorlib.dll!System.Threading.Tasks.Task.FinishStageThree()	Unknown
mscorlib.dll!System.Threading.Tasks.Task<System.Threading.Tasks.VoidTaskResult>.TrySetResult(System.Threading.Tasks.VoidTaskResult result)	Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.SetResult(System.Threading.Tasks.VoidTaskResult result)	Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()	Unknown

MyApp.Api.exe!MyApp.Api.Startup.Configure.AnonymousMethod__3_5(Microsoft.AspNetCore.Authentication.JwtBearer.TokenValidatedContext ctx = {Microsoft.AspNetCore.Authentication.JwtBearer.TokenValidatedContext}) Line 279 C#
[Resuming Async Method]
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(object stateMachine) Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() Unknown
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__0() Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke() Unknown
mscorlib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining, ref System.Threading.Tasks.Task currentTask = null) Unknown
mscorlib.dll!System.Threading.Tasks.Task.FinishContinuations() Unknown
mscorlib.dll!System.Threading.Tasks.Task.FinishStageThree() Unknown
mscorlib.dll!System.Threading.Tasks.Task<System.__Canon>.TrySetResult(System.__Canon result) Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Security.Claims.ClaimsIdentity>.SetResult(System.Security.Claims.ClaimsIdentity result) Unknown
MyApp.Package.dll!MyApp.Package.Users.Services.CurrentUserClaimsTransformationService.SetupCurrentUser(string appName = "myapi", string subject = "mytokenid") Line 197 C#
[Resuming Async Method]
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(object stateMachine) Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() Unknown
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__0() Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke() Unknown
mscorlib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining, ref System.Threading.Tasks.Task currentTask = null) Unknown
mscorlib.dll!System.Threading.Tasks.Task.FinishContinuations() Unknown
mscorlib.dll!System.Threading.Tasks.Task.FinishStageThree() Unknown
mscorlib.dll!System.Threading.Tasks.Task<System.__Canon>.TrySetResult(System.__Canon result) Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<MyApp.Core.Model.Users.StoredUser>.SetResult(MyApp.Core.Model.Users.StoredUser result) Unknown
MyApp.Data.dll!StackExchange.Redis.RedisExtensions.GetStoredUserAsync(Microsoft.Extensions.Caching.Distributed.IDistributedCache cache = {Microsoft.Extensions.Caching.Redis.RedisCache}, string subject = "mytokenid") Line 73 C#
[Resuming Async Method]
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(object stateMachine) Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() Unknown
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__0() Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke() Unknown
mscorlib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining, ref System.Threading.Tasks.Task currentTask = null) Unknown
mscorlib.dll!System.Threading.Tasks.Task.FinishContinuations() Unknown
mscorlib.dll!System.Threading.Tasks.Task.FinishStageThree() Unknown
mscorlib.dll!System.Threading.Tasks.Task.FinishStageTwo() Unknown
mscorlib.dll!System.Threading.Tasks.Task.Finish(bool bUserDelegateExecuted) Unknown
mscorlib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot = null) Unknown
mscorlib.dll!System.Threading.Tasks.Task.ExecuteEntry(bool bPreventDoubleExecution) Unknown
mscorlib.dll!System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() Unknown
mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch() Unknown
mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() Unknown

@Eilon Eilon reopened this Jul 21, 2017
@davidfowl
Copy link
Member

It seems DI related from looking at both call stacks but hard to say for sure. The error handler and the status code paves middleware both re execute the pipeline so it may be another area of interest

@alohaninja
Copy link

@davidfowl - downloaded the source for Microsoft.Extensions.DependencyInjection and narrowed it down to ServiceProvider.cs after ~30 man-hours worth of investigating (as we didn't know where the SO was actually occurring). We were using version 1.0.1 and it appears the preview 2.0 still includes this code block.

Here is the fix for it (commented out the offending code block), but I don't know the intent so someone on the DEV team should articulate what this is supposed to be doing. I suspect this background thread is creating a race condition which ultimately resulted in the SO.

internal static Func<ServiceProvider, object> RealizeService(Type serviceType, IServiceCallSite callSite)
{
    var callCount = 0;
    return provider =>
    {
        //if (Interlocked.Increment(ref callCount) == 2)
        //{
        //    Task.Run(() =>
        //    {
        //        var realizedService = new CallSiteExpressionBuilder(_callSiteRuntimeResolver)
        //            .Build(callSite);
        //        provider.RealizedServices[serviceType] = realizedService;
        //    });
        //}
        return _callSiteRuntimeResolver.Resolve(callSite, provider);
    };
}

This was a difficult one to triage - 1.0.1 .NET Core DI is still using XPROJ, had to migrate to CSPROJ and project reference both DI and DI Abstractions after adding some instrumentation. May consider trying another DI container next time instead of diving this deep. Happy to make this a PR so others can benefit. No doubt enjoying the .NET Core stack. =)

@davidfowl
Copy link
Member

davidfowl commented Jul 24, 2017

@alohaninja That code can't be commented out, it's required to make things fast and should be thread safe. The fact that it does fix your issue makes me curious though. Do you have a consistent repro yet? It's likely some race condition, plus how your services are defined. Do you know which service is causing the stackoverflow?

/cc @pakrym

@alohaninja
Copy link

ServiceProvider.RealizeService is not thread safe as there is definitely a race condition, while stepping through the source background threads the SO doesn't occur. For now we swapped out the DI container using Autofac.Extensions.DependencyInjection and it works just fine - it proves that the SO is occurring because of a bug in the MS DI container.

Given the complexity of our SLN setup we can't easily share the source, but it is consistently reproducible. Narrowing it down to the above statement should help someone identify it - for now we'll probably just stick with AutoFac until we hear any updates back from you.

Here is a stack dump from the background thread created by this method before it dies.

Microsoft.Extensions.DependencyInjection.Abstractions.dll!Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ImplementationType.get() Line 125	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitCreateInstance(Microsoft.Extensions.DependencyInjection.ServiceLookup.CreateInstanceCallSite createInstanceCallSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.CreateInstanceCallSite}, System.Linq.Expressions.ParameterExpression provider = {System.Linq.Expressions.TypedParameterExpression}) Line 101	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.CreateInstanceCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 47	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression provider = {System.Linq.Expressions.TypedParameterExpression}) Line 177	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 37	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitConstructor.AnonymousMethod__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite c = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, int index = 2) Line 158	C#
 	System.Core.dll!System.Linq.Enumerable.SelectIterator<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, System.Linq.Expressions.UnaryExpression>(System.Collections.Generic.IEnumerable<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite> source = {Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite[3]}, System.Func<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, int, System.Linq.Expressions.UnaryExpression> selector = {Method = {System.Reflection.RuntimeMethodInfo}})	Unknown
 	mscorlib.dll!System.Collections.Generic.List<System.Linq.Expressions.Expression>.List(System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> collection)	Unknown
 	System.Core.dll!System.Dynamic.Utils.CollectionExtensions.ToReadOnly<System.Linq.Expressions.Expression>(System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> enumerable)	Unknown
 	System.Core.dll!System.Linq.Expressions.Expression.New(System.Reflection.ConstructorInfo constructor = {System.Reflection.RuntimeConstructorInfo}, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments)	Unknown
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite callSite = {System.Linq.Expressions.TypedParameterExpression}, System.Linq.Expressions.ParameterExpression provider = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite}) Line 155	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 22	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression provider = {System.Linq.Expressions.TypedParameterExpression}) Line 177	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 37	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitConstructor.AnonymousMethod__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite c = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, int index = 0) Line 158	C#
 	System.Core.dll!System.Linq.Enumerable.SelectIterator<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, System.Linq.Expressions.UnaryExpression>(System.Collections.Generic.IEnumerable<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite> source = {Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite[1]}, System.Func<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, int, System.Linq.Expressions.UnaryExpression> selector = {Method = {System.Reflection.RuntimeMethodInfo}})	Unknown
 	mscorlib.dll!System.Collections.Generic.List<System.Linq.Expressions.Expression>.List(System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> collection)	Unknown
 	System.Core.dll!System.Dynamic.Utils.CollectionExtensions.ToReadOnly<System.Linq.Expressions.Expression>(System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> enumerable)	Unknown
 	System.Core.dll!System.Linq.Expressions.Expression.New(System.Reflection.ConstructorInfo constructor = {System.Reflection.RuntimeConstructorInfo}, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments)	Unknown
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite callSite = {System.Linq.Expressions.TypedParameterExpression}, System.Linq.Expressions.ParameterExpression provider = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite}) Line 155	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 22	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression provider = {System.Linq.Expressions.TypedParameterExpression}) Line 177	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 37	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitConstructor.AnonymousMethod__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite c = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, int index = 2) Line 158	C#
 	System.Core.dll!System.Linq.Enumerable.SelectIterator<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, System.Linq.Expressions.UnaryExpression>(System.Collections.Generic.IEnumerable<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite> source = {Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite[3]}, System.Func<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, int, System.Linq.Expressions.UnaryExpression> selector = {Method = {System.Reflection.RuntimeMethodInfo}})	Unknown
 	mscorlib.dll!System.Collections.Generic.List<System.Linq.Expressions.Expression>.List(System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> collection)	Unknown
 	System.Core.dll!System.Dynamic.Utils.CollectionExtensions.ToReadOnly<System.Linq.Expressions.Expression>(System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> enumerable)	Unknown
 	System.Core.dll!System.Linq.Expressions.Expression.New(System.Reflection.ConstructorInfo constructor = {System.Reflection.RuntimeConstructorInfo}, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments)	Unknown
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite callSite = {System.Linq.Expressions.TypedParameterExpression}, System.Linq.Expressions.ParameterExpression provider = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite}) Line 155	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 22	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression provider = {System.Linq.Expressions.TypedParameterExpression}) Line 177	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 37	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitConstructor.AnonymousMethod__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite c = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, int index = 3) Line 158	C#
 	System.Core.dll!System.Linq.Enumerable.SelectIterator<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, System.Linq.Expressions.UnaryExpression>(System.Collections.Generic.IEnumerable<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite> source = {Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite[6]}, System.Func<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, int, System.Linq.Expressions.UnaryExpression> selector = {Method = {System.Reflection.RuntimeMethodInfo}})	Unknown
 	mscorlib.dll!System.Collections.Generic.List<System.Linq.Expressions.Expression>.List(System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> collection)	Unknown
 	System.Core.dll!System.Dynamic.Utils.CollectionExtensions.ToReadOnly<System.Linq.Expressions.Expression>(System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> enumerable)	Unknown
 	System.Core.dll!System.Linq.Expressions.Expression.New(System.Reflection.ConstructorInfo constructor = {System.Reflection.RuntimeConstructorInfo}, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments)	Unknown
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite callSite = {System.Linq.Expressions.TypedParameterExpression}, System.Linq.Expressions.ParameterExpression provider = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite}) Line 155	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 22	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression provider = {System.Linq.Expressions.TypedParameterExpression}) Line 177	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 37	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitConstructor.AnonymousMethod__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite c = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, int index = 0) Line 158	C#
 	System.Core.dll!System.Linq.Enumerable.SelectIterator<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, System.Linq.Expressions.UnaryExpression>(System.Collections.Generic.IEnumerable<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite> source = {Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite[2]}, System.Func<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, int, System.Linq.Expressions.UnaryExpression> selector = {Method = {System.Reflection.RuntimeMethodInfo}})	Unknown
 	mscorlib.dll!System.Collections.Generic.List<System.Linq.Expressions.Expression>.List(System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> collection)	Unknown
 	System.Core.dll!System.Dynamic.Utils.CollectionExtensions.ToReadOnly<System.Linq.Expressions.Expression>(System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> enumerable)	Unknown
 	System.Core.dll!System.Linq.Expressions.Expression.New(System.Reflection.ConstructorInfo constructor = {System.Reflection.RuntimeConstructorInfo}, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments)	Unknown
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite callSite = {System.Linq.Expressions.TypedParameterExpression}, System.Linq.Expressions.ParameterExpression provider = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite}) Line 155	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 22	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression provider = {System.Linq.Expressions.TypedParameterExpression}) Line 177	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 37	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitConstructor.AnonymousMethod__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite c = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, int index = 0) Line 158	C#
 	System.Core.dll!System.Linq.Enumerable.SelectIterator<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, System.Linq.Expressions.UnaryExpression>(System.Collections.Generic.IEnumerable<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite> source = {Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite[3]}, System.Func<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, int, System.Linq.Expressions.UnaryExpression> selector = {Method = {System.Reflection.RuntimeMethodInfo}})	Unknown
 	mscorlib.dll!System.Collections.Generic.List<System.Linq.Expressions.Expression>.List(System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> collection)	Unknown
 	System.Core.dll!System.Dynamic.Utils.CollectionExtensions.ToReadOnly<System.Linq.Expressions.Expression>(System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> enumerable)	Unknown
 	System.Core.dll!System.Linq.Expressions.Expression.New(System.Reflection.ConstructorInfo constructor = {System.Reflection.RuntimeConstructorInfo}, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments)	Unknown
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite callSite = {System.Linq.Expressions.TypedParameterExpression}, System.Linq.Expressions.ParameterExpression provider = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite}) Line 155	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 22	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression provider = {System.Linq.Expressions.TypedParameterExpression}) Line 177	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 37	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitConstructor.AnonymousMethod__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite c = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, int index = 10) Line 158	C#
 	System.Core.dll!System.Linq.Enumerable.SelectIterator<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, System.Linq.Expressions.UnaryExpression>(System.Collections.Generic.IEnumerable<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite> source = {Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite[11]}, System.Func<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, int, System.Linq.Expressions.UnaryExpression> selector = {Method = {System.Reflection.RuntimeMethodInfo}})	Unknown
 	mscorlib.dll!System.Collections.Generic.List<System.Linq.Expressions.Expression>.List(System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> collection)	Unknown
 	System.Core.dll!System.Dynamic.Utils.CollectionExtensions.ToReadOnly<System.Linq.Expressions.Expression>(System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> enumerable)	Unknown
 	System.Core.dll!System.Linq.Expressions.Expression.New(System.Reflection.ConstructorInfo constructor = {System.Reflection.RuntimeConstructorInfo}, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments)	Unknown
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite callSite = {System.Linq.Expressions.TypedParameterExpression}, System.Linq.Expressions.ParameterExpression provider = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite}) Line 155	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 22	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression provider = {System.Linq.Expressions.TypedParameterExpression}) Line 177	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 37	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitConstructor.AnonymousMethod__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite c = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, int index = 7) Line 158	C#
 	System.Core.dll!System.Linq.Enumerable.SelectIterator<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, System.Linq.Expressions.UnaryExpression>(System.Collections.Generic.IEnumerable<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite> source = {Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite[9]}, System.Func<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, int, System.Linq.Expressions.UnaryExpression> selector = {Method = {System.Reflection.RuntimeMethodInfo}})	Unknown
 	mscorlib.dll!System.Collections.Generic.List<System.Linq.Expressions.Expression>.List(System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> collection)	Unknown
 	System.Core.dll!System.Dynamic.Utils.CollectionExtensions.ToReadOnly<System.Linq.Expressions.Expression>(System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> enumerable)	Unknown
 	System.Core.dll!System.Linq.Expressions.Expression.New(System.Reflection.ConstructorInfo constructor = {System.Reflection.RuntimeConstructorInfo}, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments)	Unknown
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite callSite = {System.Linq.Expressions.TypedParameterExpression}, System.Linq.Expressions.ParameterExpression provider = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite}) Line 155	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 22	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression provider = {System.Linq.Expressions.TypedParameterExpression}) Line 177	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 37	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitConstructor.AnonymousMethod__0(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite c = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, int index = 9) Line 158	C#
 	System.Core.dll!System.Linq.Enumerable.SelectIterator<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, System.Linq.Expressions.UnaryExpression>(System.Collections.Generic.IEnumerable<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite> source = {Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite[21]}, System.Func<Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite, int, System.Linq.Expressions.UnaryExpression> selector = {Method = {System.Reflection.RuntimeMethodInfo}})	Unknown
 	mscorlib.dll!System.Collections.Generic.List<System.Linq.Expressions.Expression>.List(System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> collection)	Unknown
 	System.Core.dll!System.Dynamic.Utils.CollectionExtensions.ToReadOnly<System.Linq.Expressions.Expression>(System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> enumerable)	Unknown
 	System.Core.dll!System.Linq.Expressions.Expression.New(System.Reflection.ConstructorInfo constructor = {System.Reflection.RuntimeConstructorInfo}, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> arguments)	Unknown
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitConstructor(Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite callSite = {System.Linq.Expressions.TypedParameterExpression}, System.Linq.Expressions.ParameterExpression provider = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite}) Line 155	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 22	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.VisitScoped(Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression provider = {System.Linq.Expressions.TypedParameterExpression}) Line 177	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor<System.Linq.Expressions.ParameterExpression, System.Linq.Expressions.Expression>.VisitCallSite(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}, System.Linq.Expressions.ParameterExpression argument = {System.Linq.Expressions.TypedParameterExpression}) Line 37	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.BuildExpression(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}) Line 61	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder.Build(Microsoft.Extensions.DependencyInjection.ServiceLookup.IServiceCallSite callSite = {Microsoft.Extensions.DependencyInjection.ServiceLookup.ScopedCallSite}) Line 56	C#
 	Microsoft.Extensions.DependencyInjection.dll!Microsoft.Extensions.DependencyInjection.ServiceProvider.RealizeService.AnonymousMethod__1() Line 94	C#
 	mscorlib.dll!System.Threading.Tasks.Task.InnerInvoke()	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.Execute()	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.ExecutionContextCallback(object obj)	Unknown
 	mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot = Id = 1800, Status = Running, Method = "Void <RealizeService>b__1()")	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.ExecuteEntry(bool bPreventDoubleExecution)	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()	Unknown
 	mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()	Unknown
 	mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()	Unknown

@davidfowl
Copy link
Member

I've opened aspnet/DependencyInjection#555. Closing this bug as it isn't an MVC issue.

@davidfowl
Copy link
Member

@alohaninja it would be super useful if you could identify which service was being resolved and if you could give us the service registrations for that call chain. We could at least begin to identify where to start looking. Regardless, we'll try to identify where the problem is. Thanks for the details.

@alohaninja
Copy link

@davidfowl we have roughly 200+ service registrations so it's not a single service that is causing it to fail. The call chain get's fairly deep depending on what our app is doing.

If you or someone who's working on this project are in St. Petersburg - stop in and we'll be happy to demo it to you. I doubt we could easily create a repro SLN given the large # of dependencies.

@rybama
Copy link

rybama commented Aug 4, 2017

I can confirm we have this issue as well. I don't know if this is the solution, but I can say that refactoring helped for this instance. This exception is very troubling though as it crashes kestrel
Service with dependencies:
Controller
-- Service1
-- Service2
---- Service1
What helped is moving common code to a separate Service
Controller
-- Service1
---- Service3 (common methods from Service1)
-- Service2
---- Service3 (common methods from Service1)

@davidfowl
Copy link
Member

@xxjthxx If you can reproduce the issue it would be amazing if you can send us a code sample.

@pakrym
Copy link
Contributor

pakrym commented Aug 4, 2017

@xxjthxx Do you happen to have serviceProvider.GetService call in one of the constructors?

@rybama
Copy link

rybama commented Aug 5, 2017

@pakrym definetely no

@davidfowl
Copy link
Member

@xxjthxx Can you share the service definitions that caused the problem?

@rybama
Copy link

rybama commented Aug 5, 2017

@davidfowl For now I only managed to find the exact class (it's a Scoped service) which is causing this by attaching DI source code. Unfortunately I'm not sure all services will help you because this one problem we discovered in our e2e test, not in manual tests or normal usage. This path is highly reproducible though so we could pair programming via skype if you're interested. The exception is in the GetService method and return realizedService.Invoke(this); line.

@davidfowl
Copy link
Member

This path is highly reproducible though so we could pair programming via skype if you're interested.

@xxjthxx Can you make a project that reproduces the problem?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants