Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal CLR error when stepping over an await statement #13590

Closed
softwaretirol opened this issue Oct 15, 2019 · 25 comments
Closed

Internal CLR error when stepping over an await statement #13590

softwaretirol opened this issue Oct 15, 2019 · 25 comments
Labels
area-Diagnostics-coreclr tenet-reliability Reliability/stability related issue (stress, load problems, etc.)
Milestone

Comments

@softwaretirol
Copy link

softwaretirol commented Oct 15, 2019

Issue Title

During debugging an application, the app is crashing. It happens completly randomly, but most of the time if you step over an "await .." statement.

How can i provide you more information? It is a large .NET Core 3.0 application, so a sample is a little bit hard to create.

General

Fatal error. Internal CLR error. (0x80131506)
   at Benchmark.BenchmarkRun.WebApi.TestWebApiController.Get(System.Nullable`1<Int32>)
   at DynamicClass.lambda_method(System.Runtime.CompilerServices.Closure, System.Object, System.Object[])
   at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(System.Object, System.Object[])
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor+SyncObjectResultExecutor.Execute(Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultTypeMapper, Microsoft.Extensions.Internal.ObjectMethodExecutor, System.Object, System.Object[])
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Mvc.Routing.ActionEndpointFactory+<>c__DisplayClass7_0.<CreateRequestDelegate>b__0(Microsoft.AspNetCore.Http.HttpContext)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware+<Invoke>d__5.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Microsoft.AspNetCore.Authorization.AuthorizationMiddleware+<Invoke>d__5, Microsoft.AspNetCore.Authorization.Policy, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<Invoke>d__5 ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Microsoft.AspNetCore.Authorization.AuthorizationMiddleware+<Invoke>d__5, Microsoft.AspNetCore.Authorization.Policy, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<Invoke>d__5 ByRef)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext)
   at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.SetRoutingAndContinue(Microsoft.AspNetCore.Http.HttpContext)
   at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext)
   at ILEngine.Contracts.WebApi.WebApiHost.Execute(Microsoft.AspNetCore.Http.DefaultHttpContext)
   at ILEngine.Contracts.WebApi.ILWebApi+<Run>d__9.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Start[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
   at ILEngine.Contracts.WebApi.ILWebApi.Run(ILEngine.Coordinator.Contracts.HttpRequestData)
   at ILEngine.Worker.WorkerApi+<InvokePackageApi>d__19.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Start[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
   at ILEngine.Worker.WorkerApi.InvokePackageApi(System.Guid, System.String, System.String, System.String, ILEngine.Coordinator.Contracts.HttpRequestData)
   at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean, Boolean)
   at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at System.Reflection.MethodBase.Invoke(System.Object, System.Object[])
   at ILEngine.Communication.Handler.ApiMethod.Invoke(System.Object, System.Object[])
   at ILEngine.Communication.Handler.NetworkMethodInvoker+<Invoke>d__6.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
   at ILEngine.Communication.Handler.NetworkMethodInvoker.Invoke(ILEngine.Communication.Handler.SocketHandler, Int64, ILEngine.Communication.Handler.ApiMethod, ILEngine.Contracts.InvokeArgument[])
   at ILEngine.Communication.Handler.NetworkMethodInvoker+<HandleInvokeMessage>d__5.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ExecutionContextCallback(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext(System.Threading.Thread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
   at System.Runtime.CompilerServices.YieldAwaitable+YieldAwaiter+<>c.<OutputCorrelationEtwEvent>b__6_0(System.Action, System.Threading.Tasks.Task)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+ContinuationWrapper.Invoke()
   at System.Runtime.CompilerServices.YieldAwaitable+YieldAwaiter.RunAction(System.Object)
   at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
@scalablecory scalablecory transferred this issue from dotnet/core Oct 15, 2019
@scalablecory
Copy link
Contributor

scalablecory commented Oct 15, 2019

Can you provide a repro?

I see you're using something called "ILEngine". I don't know what this is, but if it is generating IL it seems a likely source of this bug.

@msftgits msftgits transferred this issue from dotnet/coreclr Jan 31, 2020
@msftgits msftgits added this to the 5.0 milestone Jan 31, 2020
@jkotas jkotas added tenet-reliability Reliability/stability related issue (stress, load problems, etc.) and removed reliability labels Feb 4, 2020
@xsoheilalizadeh
Copy link

xsoheilalizadeh commented Jun 3, 2020

I have the same issue while using Elasticsearch.Net at ElasticSearchStore#L42. You can reproduce it by running the sample.

dotnet info

.NET Core SDK (reflecting any global.json):
 Version:   5.0.100-preview.3.20216.6
 Commit:    9f62a32109

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19628
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.100-preview.3.20216.6\

Host (useful for support):
  Version: 5.0.0-preview.3.20214.6
  Commit:  b037784658

.NET SDKs installed:
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.2.108 [C:\Program Files\dotnet\sdk]
  2.2.207 [C:\Program Files\dotnet\sdk]
  3.1.201 [C:\Program Files\dotnet\sdk]
  3.1.202 [C:\Program Files\dotnet\sdk]
  3.1.300-preview-015135 [C:\Program Files\dotnet\sdk]
  5.0.100-preview.3.20216.6 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0-preview.3.20215.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0-preview.3.20214.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.0-preview.3.20214.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Stack Trace

Fatal error. Internal CLR error. (0x80131506)
   at System.Collections.Generic.ICollection`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].get_IsReadOnly()
   at DynamicClass.Serialize(Byte[][], System.Object[], Elasticsearch.Net.Utf8Json.JsonWriter ByRef, Microsoft.Extensions.Primitives.StringValues, Elasticsearch.Net.Utf8Json.IJsonFormatterResolver)
   at Elasticsearch.Net.Utf8Json.Resolvers.DynamicMethodAnonymousFormatter`1[[Microsoft.Extensions.Primitives.StringValues, Microsoft.Extensions.Primitives, Version=3.1.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].Serialize(Elasticsearch.Net.Utf8Json.JsonWriter ByRef, Microsoft.Extensions.Primitives.StringValues, Elasticsearch.Net.Utf8Json.IJsonFormatterResolver)
   at Elasticsearch.Net.Utf8Json.Formatters.KeyValuePairFormatter`2[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Extensions.Primitives.StringValues, Microsoft.Extensions.Primitives, Version=3.1.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].Serialize(Elasticsearch.Net.Utf8Json.JsonWriter ByRef, System.Collections.Generic.KeyValuePair`2<System.__Canon,Microsoft.Extensions.Primitives.StringValues>, Elasticsearch.Net.Utf8Json.IJsonFormatterResolver)
   at Elasticsearch.Net.Utf8Json.Formatters.CollectionFormatterBase`4[[System.Collections.Generic.KeyValuePair`2[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Extensions.Primitives.StringValues, Microsoft.Extensions.Primitives, Version=3.1.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]], System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Elasticsearch.Net.Utf8Json.Internal.ArrayBuffer`1[[System.Collections.Generic.KeyValuePair`2[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.Extensions.Primitives.StringValues, Microsoft.Extensions.Primitives, Version=3.1.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]], System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Elasticsearch.Net, Version=7.0.0.0, Culture=neutral, PublicKeyToken=96c599bbe3e70f5d],[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Serialize(Elasticsearch.Net.Utf8Json.JsonWriter ByRef, System.__Canon, Elasticsearch.Net.Utf8Json.IJsonFormatterResolver)
   at DynamicClass.Serialize(Byte[][], System.Object[], Elasticsearch.Net.Utf8Json.JsonWriter ByRef, raccoonLog.HttpRequestLog, Elasticsearch.Net.Utf8Json.IJsonFormatterResolver)
   at Elasticsearch.Net.Utf8Json.Resolvers.DynamicMethodAnonymousFormatter`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Serialize(Elasticsearch.Net.Utf8Json.JsonWriter ByRef, System.__Canon, Elasticsearch.Net.Utf8Json.IJsonFormatterResolver)
   at DynamicClass.Serialize(Byte[][], System.Object[], Elasticsearch.Net.Utf8Json.JsonWriter ByRef, raccoonLog.LogContext, Elasticsearch.Net.Utf8Json.IJsonFormatterResolver)
   at Elasticsearch.Net.Utf8Json.Resolvers.DynamicMethodAnonymousFormatter`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Serialize(Elasticsearch.Net.Utf8Json.JsonWriter ByRef, System.__Canon, Elasticsearch.Net.Utf8Json.IJsonFormatterResolver)
   at Elasticsearch.Net.Utf8Json.JsonSerializer+<SerializeAsync>d__11`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Elasticsearch.Net.Utf8Json.JsonSerializer+<SerializeAsync>d__11`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Elasticsearch.Net, Version=7.0.0.0, Culture=neutral, PublicKeyToken=96c599bbe3e70f5d]](<SerializeAsync>d__11`1<System.__Canon> ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Elasticsearch.Net.Utf8Json.JsonSerializer+<SerializeAsync>d__11`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Elasticsearch.Net, Version=7.0.0.0, Culture=neutral, PublicKeyToken=96c599bbe3e70f5d]](<SerializeAsync>d__11`1<System.__Canon> ByRef)
   at Elasticsearch.Net.Utf8Json.JsonSerializer.SerializeAsync[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.IO.Stream, System.__Canon, Elasticsearch.Net.Utf8Json.IJsonFormatterResolver)
   at Elasticsearch.Net.LowLevelRequestResponseSerializer.SerializeAsync[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon, System.IO.Stream, Elasticsearch.Net.SerializationFormatting, System.Threading.CancellationToken)
   at Elasticsearch.Net.DiagnosticsSerializerProxy.SerializeAsync[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon, System.IO.Stream, Elasticsearch.Net.SerializationFormatting, System.Threading.CancellationToken)
   at Elasticsearch.Net.SerializableData`1+<WriteAsync>d__4[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Elasticsearch.Net.SerializableData`1+<WriteAsync>d__4[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Elasticsearch.Net, Version=7.0.0.0, Culture=neutral, PublicKeyToken=96c599bbe3e70f5d]](<WriteAsync>d__4<System.__Canon> ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Elasticsearch.Net.SerializableData`1+<WriteAsync>d__4[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Elasticsearch.Net, Version=7.0.0.0, Culture=neutral, PublicKeyToken=96c599bbe3e70f5d]](<WriteAsync>d__4<System.__Canon> ByRef)
   at Elasticsearch.Net.SerializableData`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].WriteAsync(System.IO.Stream, Elasticsearch.Net.IConnectionConfigurationValues, System.Threading.CancellationToken)
   at Elasticsearch.Net.HttpConnection+<SetContentAsync>d__17.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Elasticsearch.Net.HttpConnection+<SetContentAsync>d__17, Elasticsearch.Net, Version=7.0.0.0, Culture=neutral, PublicKeyToken=96c599bbe3e70f5d]](<SetContentAsync>d__17 ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Elasticsearch.Net.HttpConnection+<SetContentAsync>d__17, Elasticsearch.Net, Version=7.0.0.0, Culture=neutral, PublicKeyToken=96c599bbe3e70f5d]](<SetContentAsync>d__17 ByRef)
   at Elasticsearch.Net.HttpConnection.SetContentAsync(System.Net.Http.HttpRequestMessage, Elasticsearch.Net.RequestData, System.Threading.CancellationToken)
   at Elasticsearch.Net.HttpConnection+<RequestAsync>d__7`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Elasticsearch.Net.HttpConnection+<RequestAsync>d__7`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Elasticsearch.Net, Version=7.0.0.0, Culture=neutral, PublicKeyToken=96c599bbe3e70f5d]](<RequestAsync>d__7`1<System.__Canon> ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Start[[Elasticsearch.Net.HttpConnection+<RequestAsync>d__7`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Elasticsearch.Net, Version=7.0.0.0, Culture=neutral, PublicKeyToken=96c599bbe3e70f5d]](<RequestAsync>d__7`1<System.__Canon> ByRef)
   at Elasticsearch.Net.HttpConnection.RequestAsync[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Elasticsearch.Net.RequestData, System.Threading.CancellationToken)
   at Elasticsearch.Net.RequestPipeline+<CallElasticsearchAsync>d__57`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Elasticsearch.Net.RequestPipeline+<CallElasticsearchAsync>d__57`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Elasticsearch.Net, Version=7.0.0.0, Culture=neutral, PublicKeyToken=96c599bbe3e70f5d]](<CallElasticsearchAsync>d__57`1<System.__Canon> ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Start[[Elasticsearch.Net.RequestPipeline+<CallElasticsearchAsync>d__57`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Elasticsearch.Net, Version=7.0.0.0, Culture=neutral, PublicKeyToken=96c599bbe3e70f5d]](<CallElasticsearchAsync>d__57`1<System.__Canon> ByRef)
   at Elasticsearch.Net.RequestPipeline.CallElasticsearchAsync[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Elasticsearch.Net.RequestData, System.Threading.CancellationToken)
   at Elasticsearch.Net.Transport`1+<RequestAsync>d__15`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Elasticsearch.Net.Transport`1+<RequestAsync>d__15`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Elasticsearch.Net, Version=7.0.0.0, Culture=neutral, PublicKeyToken=96c599bbe3e70f5d]](<RequestAsync>d__15`1<System.__Canon,System.__Canon> ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Start[[Elasticsearch.Net.Transport`1+<RequestAsync>d__15`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Elasticsearch.Net, Version=7.0.0.0, Culture=neutral, PublicKeyToken=96c599bbe3e70f5d]](<RequestAsync>d__15`1<System.__Canon,System.__Canon> ByRef)
   at Elasticsearch.Net.Transport`1[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].RequestAsync[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Elasticsearch.Net.HttpMethod, System.String, System.Threading.CancellationToken, Elasticsearch.Net.PostData, Elasticsearch.Net.IRequestParameters)
   at Elasticsearch.Net.ElasticLowLevelClient.DoRequestAsync[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Elasticsearch.Net.HttpMethod, System.String, System.Threading.CancellationToken, Elasticsearch.Net.PostData, Elasticsearch.Net.IRequestParameters)
   at Elasticsearch.Net.ElasticLowLevelClient.IndexAsync[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.String, System.String, Elasticsearch.Net.PostData, Elasticsearch.Net.IndexRequestParameters, System.Threading.CancellationToken)
   at raccoonLog.Stores.ElasticSearch.ElasticSearchStore+<StoreAsync>d__4.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
   at raccoonLog.Stores.ElasticSearch.ElasticSearchStore.StoreAsync(raccoonLog.LogContext, System.Threading.CancellationToken)
   at raccoonLog.HttpLoggingProvider+<>c__DisplayClass7_0.<LogAsync>b__0()
   at raccoonLog.StoreQueue+<Dequeue>d__3.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
   at raccoonLog.StoreQueue.Dequeue()
   at raccoonLog.StoreQueueConsumer.<StartAsync>b__4_0(System.Object, System.Timers.ElapsedEventArgs)
   at System.Timers.Timer.MyTimerCallback(System.Object)
   at System.Threading.TimerQueueTimer+<>c.<.cctor>b__23_0(System.Object)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.TimerQueueTimer.CallCallback(Boolean)
   at System.Threading.TimerQueueTimer.Fire(Boolean)
   at System.Threading.TimerQueueTimer.System.Threading.IThreadPoolWorkItem.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

@TheMinefighter
Copy link

Had the same error when using WPF and a lot of async code. Here comes my stacktrace:

Fatal error. Internal CLR error. (0x80131506)
   at MusicManagement.DBManager+<MakeUpnpAndDbEntry>d__6.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d
7bea7798e]](System.__Canon ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d
7bea7798e]](System.__Canon ByRef)
   at MusicManagement.DBManager.MakeUpnpAndDbEntry(System.String)
   at System.Linq.Enumerable+SelectIListIterator`2[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Syst
em.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
   at System.Threading.Tasks.Task.WhenAll(System.Collections.Generic.IEnumerable`1<System.Threading.Tasks.Task>)
   at MusicManagement.DBManager+<RebuildDB>d__3.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d
7bea7798e]](System.__Canon ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d
7bea7798e]](System.__Canon ByRef)
   at MusicManagement.DBManager.RebuildDB()
   at MusicManagement.MainWindow+<RebuildDB>d__15.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d
7bea7798e]](System.__Canon ByRef)
   at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d
7bea7798e]](System.__Canon ByRef)
   at MusicManagement.MainWindow.RebuildDB(System.Object, System.Windows.RoutedEventArgs)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
   at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
   at System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs)
   at System.Windows.UIElement.OnMouseLeftButtonUpThunk(System.Object, System.Windows.Input.MouseButtonEventArgs)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate, System.Object)
   at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
   at System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject, System.Windows.RoutedEventArgs, System.Windows.RoutedEvent)
   at System.Windows.UIElement.OnMouseUpThunk(System.Object, System.Windows.Input.MouseButtonEventArgs)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate, System.Object)
   at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
   at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
   at System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
   at System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawMouseActions, Int32, Int32, I
nt32)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
   at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(System.Object)
   at System.Windows.Application.RunInternal(System.Windows.Window)
   at System.Windows.Application.Run()
   at MusicManagement.App.Main()

@mangod9
Copy link
Member

mangod9 commented Jul 22, 2020

Hello @softwaretirol, @TheMinefighter would it be possible to provide a dump for this issue? Also what version of .net core does this repro on? Thx

@ghost
Copy link

ghost commented Aug 4, 2020

Tagging subscribers to this area: @tommcdon
See info in area-owners.md if you want to be subscribed.

@davidwrighton
Copy link
Member

@xsoheilalizadeh @TheMinefighter Do you see this issue only while debugging, or are you seeing the failure when not under the debugger?

@TheMinefighter
Copy link

@davidwrighton I experienced the error debugging with JB Rider, It seems not to be possible to reproduce this reliably, or at least not for me.

@davidwrighton
Copy link
Member

@tommcdon Sounds like this is a diagnostics bug. Please let me know if I can help if you can put a debugger repro together.

@tommcdon
Copy link
Member

tommcdon commented Aug 5, 2020

@davmason @hoyosjs

@hoyosjs
Copy link
Member

hoyosjs commented Aug 6, 2020

@xsoheilalizadeh I tried a few hundred iterations of the requests with stepping. I could not repro any Execution Engine exceptions. At first sight this looks like an AV in the DAC, but without some dump or full trace including native frames this is going to be very hard to address. In the sample I can also see that the SDK is fixed to 3.1.100, can you try a more recent runtime and confirm if the issue still repros?

@tommcdon tommcdon modified the milestones: 5.0.0, 6.0.0 Aug 10, 2020
@ptrace
Copy link

ptrace commented Sep 7, 2020

A very similar stacktrace happens to me, under Windows Containers with dotnet core.

c:\Program Files\dotnet>dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.301
 Commit:    7feb845744

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   c:\Program Files\dotnet\sdk\3.1.301\

Host (useful for support):
  Version: 3.1.5
  Commit:  65cd789777

.NET Core SDKs installed:
  3.1.301 [c:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.5 [c:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.5 [c:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.5 [c:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

I'm in the process of replicating it.

@xljiulang
Copy link

xljiulang commented Sep 16, 2020

Fatal error. 0x80131506
   at System.Reflection.RuntimeModule.GetTypes(System.Reflection.RuntimeModule)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at Core.ServiceCollectionDependencyExtensions.AddDependencyServices(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Reflection.Assembly)
   at HostApp.Startup.ConfigureServices(Microsoft.Extensions.DependencyInjection.IServiceCollection)
   at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean, Boolean)
   at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(System.Object, Microsoft.Extensions.DependencyInjection.IServiceCollection)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder+<>c__DisplayClass9_0.<Invoke>g__Startup|0(Microsoft.Extensions.DependencyInjection.IServiceCollection)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(System.Object, Microsoft.Extensions.DependencyInjection.IServiceCollection)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder+<>c__DisplayClass8_0.<Build>b__0(Microsoft.Extensions.DependencyInjection.IServiceCollection)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(System.Type, Microsoft.Extensions.Hosting.HostBuilderContext, Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Object)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder+<>c__DisplayClass13_0.<UseStartup>b__0(Microsoft.Extensions.Hosting.HostBuilderContext, Microsoft.Extensions.DependencyInjection.IServiceCollection)
   at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
   at Microsoft.Extensions.Hosting.HostBuilder.Build()
   at HostApp.Program.Main(System.String[])

@hoyosjs
Copy link
Member

hoyosjs commented Sep 16, 2020

@xljiulang was this while running under the debugger and stepping through your code?

@xljiulang
Copy link

@hoyosjs
no, it happens whenPublishSingleFile at dotnet 5.0(prev8 and rc1)

@hoyosjs
Copy link
Member

hoyosjs commented Sep 16, 2020

I'll open a new issue then :) That's a separate issue.

@bobbymonboy
Copy link

bobbymonboy commented Sep 30, 2020

I've just encountered this same exact error, although under slightly different circumstances; my program was not at all complex. I created a fresh console application for .NET Core 3.1, set the platform to x64, and instantiated a 2-dimensional 1-by-1 float array with a collection initializer. Stepping in debug mode throws an exception when running that line of code. Simply attempting to access a multidimensional array throws an exception as well. If not stepping, no exception is thrown. The only stack-trace it gave me was a single line for Main(), as that was where I attempted to create the array.

@hoyosjs
Copy link
Member

hoyosjs commented Oct 1, 2020

@bobbymonboy that's a different issue: #38777

@tommcdon
Copy link
Member

Unable to repro the issue, closing this issue until we have an actionable dump or repro.

@tactical-drone
Copy link

tactical-drone commented Oct 21, 2020

I get this error when I throw exceptions inside System.Threading.Tasks.Sources.IValueTaskSource<out TResult>.void OnCompleted( Action<object?> continuation, object? state, short token, ValueTaskSourceOnCompletedFlags flags);

@hoyosjs
Copy link
Member

hoyosjs commented Oct 21, 2020

Do you get this error only when a debugger is attached?

@tactical-drone
Copy link

tactical-drone commented Oct 21, 2020

I spoke to soon. Ignore the previous post.

For some bizarre reason I am getting this error today, where the code I am running has been the same, mostly and working for a while now. Bizarre.

I don't have the debugger attached, I am in (console) RELEASE mode running massive parallel async/await load consuming many chips.

Running .net 5 rc2 and possibly forgetting to set $env:DOTNET_SYSTEM_THREADING_POOLASYNCVALUETASKS = 1 which I have been extensively using and playing around with. I left it off, maybe that is what was different. App running again, but this setting has not done anything like this before.

This is all the debug info I could find:

Console stack that was dumped this time:

Fatal error. Internal CLR error. (0x80131506)
   at Org.BouncyCastle.Math.EC.Rfc8032.Ed25519.CheckPoint(Int32[], Int32[])
   at Org.BouncyCastle.Math.EC.Rfc8032.Ed25519.EncodePoint(PointAccum, Byte[], Int32)
   at Org.BouncyCastle.Math.EC.Rfc8032.Ed25519.ImplVerify(Byte[], Int32, Byte[], Int32, Byte[], Byte, Byte[], Int32, Int32)
   at zero.cocoon.models.CcSubspaceMessage+<ConsumeAsync>d__28.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[zero.cocoon.models.CcSubspaceMessage+<ConsumeAsync>d__28, zero.cocoon, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]](<ConsumeAsync>d__28 ByRef)
 ...

clr dotnet-dump stack clr threads with exceptions on them (threadid 486):

Unhandled exception: Microsoft.Diagnostics.DebugServices.DiagnosticsException: Invalid thread index: 486 ---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: index
   at System.Linq.Enumerable.ElementAt[TSource](IEnumerable`1 source, Int32 index)
   at Microsoft.Diagnostics.DebugServices.ThreadService.Microsoft.Diagnostics.DebugServices.IThreadService.GetThreadInfoFromIndex(Int32 threadIndex) in /_/src/Microsoft.Diagnostics.DebugServices/ThreadService.cs:line 285
   --- End of inner exception stack trace ---
   at Microsoft.Diagnostics.Repl.CommandProcessor.Handler.Invoke(MethodInfo methodInfo, InvocationContext context) in /_/src/Microsoft.Diagnostics.Repl/Command/CommandProcessor.cs:line 297
   at Microsoft.Diagnostics.Repl.CommandProcessor.Handler.System.CommandLine.Invocation.ICommandHandler.InvokeAsync(InvocationContext context) in /_/src/Microsoft.Diagnostics.Repl/Command/CommandProcessor.cs:line 256
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseErrorReporting>b__22_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseSuggestDirective>b__7_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseDirective>b__6_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseHelp>b__20_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass5_0.<<UseExceptionHandler>b__0>d.MoveNext()
>

@egbertn
Copy link

egbertn commented Nov 30, 2020

Same here, when using google search api when waiting for the results. First time request goes ok, second time, crash badly.

@egbertn
Copy link

egbertn commented Nov 30, 2020

Fatal error. Internal CLR error. (0x80131506)

 at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
   at CBOS.Shared.Services.GooglePlacesService.NearByPlaces(CBOS.Shared.Models.LatLong, System.Collections.Generic.IEnumerable`1<System.String>, Int32, System.String)
   at CBOS.Web.Controllers.PlacesController+<NearByPlaces>d__9.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
   at CBOS.Web.Controllers.PlacesController.NearByPlaces(Double, Double, System.Collections.Generic.IEnumerable`1<System.String>, System.Nullable`1<Int32>, System.String)
   at DynamicClass.lambda_method4(System.Runtime.CompilerServices.Closure, System.Object, System.Object[])
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor+TaskOfIActionResultExecutor+<Execute>d__0.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor+TaskOfIActionResultExecutor+<Execute>d__0, Microsoft.AspNetCore.Mvc.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<Execute>d__0 ByRef)
   at System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Start[[Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor+TaskOfIActionResultExecutor+<Execute>d__0, Microsoft.AspNetCore.Mvc.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<Execute>d__0 ByRef)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor+TaskOfIActionResultExecutor.Execute(Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultTypeMapper, Microsoft.Extensions.Internal.ObjectMethodExecutor, System.Object, System.Object[])
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker+<<InvokeActionMethodAsync>g__Logged|12_1>d.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker+<<InvokeActionMethodAsync>g__Logged|12_1>d, Microsoft.AspNetCore.Mvc.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<<InvokeActionMethodAsync>g__Logged|12_1>d ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker+<<InvokeActionMethodAsync>g__Logged|12_1>d, Microsoft.AspNetCore.Mvc.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<<InvokeActionMethodAsync>g__Logged|12_1>d ByRef)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextResourceFilter()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State ByRef, Scope ByRef, System.Object ByRef, Boolean ByRef)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker+<<InvokeAsync>g__Logged|17_1>d.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker+<<InvokeAsync>g__Logged|17_1>d, Microsoft.AspNetCore.Mvc.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<<InvokeAsync>g__Logged|17_1>d ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker+<<InvokeAsync>g__Logged|17_1>d, Microsoft.AspNetCore.Mvc.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<<InvokeAsync>g__Logged|17_1>d ByRef)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Mvc.Routing.ActionEndpointFactory+<>c__DisplayClass7_0.<CreateRequestDelegate>b__0(Microsoft.AspNetCore.Http.HttpContext)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware+<Invoke>d__6.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Microsoft.AspNetCore.Authorization.AuthorizationMiddleware+<Invoke>d__6, Microsoft.AspNetCore.Authorization.Policy, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<Invoke>d__6 ByRef)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext)
   at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext, Microsoft.AspNetCore.Cors.Infrastructure.ICorsPolicyProvider)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware+<Invoke>d__5.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware+<Invoke>d__5, Swashbuckle.AspNetCore.SwaggerUI, Version=5.6.3.0, Culture=neutral, PublicKeyToken=4232c99127b3c254]](<Invoke>d__5 ByRef)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware+<Invoke>d__4.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware+<Invoke>d__4, Swashbuckle.AspNetCore.Swagger, Version=5.6.3.0, Culture=neutral, PublicKeyToken=62657d7474907593]](<Invoke>d__4 ByRef)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext, Swashbuckle.AspNetCore.Swagger.ISwaggerProvider)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware+<Invoke>d__9.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware+<Invoke>d__9, Microsoft.AspNetCore.Diagnostics, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]](<Invoke>d__9 ByRef)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext)
   at Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol+<ProcessRequests>d__223`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol+<ProcessRequests>d__223`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Microsoft.AspNetCore.Server.Kestrel.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext(System.Threading.Thread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol+<ProcessRequests>d__223`1[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Microsoft.AspNetCore.Server.Kestrel.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].ExecuteFromThreadPool(System.Threading.Thread)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

@hoyosjs
Copy link
Member

hoyosjs commented Dec 2, 2020

@egbertn was this only happening with the debugger attached? Also, do you have any version information?

@hoyosjs hoyosjs changed the title Fatal error. Internal CLR error. (0x80131506) Internal CLR error when stepping over an await statement Dec 2, 2020
@egbertn
Copy link

egbertn commented Dec 2, 2020

@egbertn was this only happening with the debugger attached? Also, do you have any version information?

Yes, during debugging.
@hoyosjs
VS 16.8.2
.NET Core 5.0.100
I worked around it by removing the hybrid async code from a library (basically pre native-async methods).
Also, it contained an IDisposable pattern which was to cleanup httpclient I placed dispose within the scope of the function. <- don't think that could attribute to the carsh

@ghost ghost locked as resolved and limited conversation to collaborators Jan 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Diagnostics-coreclr tenet-reliability Reliability/stability related issue (stress, load problems, etc.)
Projects
None yet
Development

No branches or pull requests