Nest 6.6 getting InvalidProgramException sometimes

We're running a microservice, using Nest 6.6, and sometimes, on the first SearchAsync<{someclass}>() call, we get a System.InvalidProgramException: Common Language Runtime detected an invalid program. Here is the stack trace:

System.InvalidProgramException: Common Language Runtime detected an invalid program.
at Elasticsearch.Net.Transport1.RequestAsync[TResponse](HttpMethod method, String path, CancellationToken cancellationToken, PostData data, IRequestParameters requestParameters) at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at Elasticsearch.Net.Transport1.RequestAsync[TResponse](HttpMethod method, String path, CancellationToken cancellationToken, PostData data, IRequestParameters requestParameters)
at Elasticsearch.Net.ElasticLowLevelClient.DoRequestAsync[TResponse](HttpMethod method, String path, CancellationToken cancellationToken, PostData data, IRequestParameters requestParameters)
at Elasticsearch.Net.ElasticLowLevelClient.SearchAsync[TResponse](String index, String type, PostData body, SearchRequestParameters requestParameters, CancellationToken ctx)
at Nest.LowLevelDispatch.SearchDispatchAsync[TResponse](IRequest1 p, SerializableData1 body, CancellationToken ct)
at Nest.ElasticClient.b__562_0[T,TResult](ISearchRequest p, SerializableData1 d, CancellationToken c) at Nest.ElasticClient.Nest.IHighLevelToLowLevelDispatcher.DispatchAsync[TRequest,TQueryString,TResponse,TResponseInterface](TRequest request, CancellationToken cancellationToken, Func3 responseGenerator, Func`4 dispatch)
at Catalog.ProductCatalogSuggest.Icp.Service.Providers.ElasticsearchSuggestProvider.StoreSuggestAsync(Int32 storeId, String query, Int32 size) in /root/repo/src/Catalog.ProductCatalogSuggest.Icp.Service/Providers/ElasticsearchSuggestProvider.cs:line 89

What's weird is that if we replace this with a standard Search call, we don't get these errors.

Any ideas?

Thanks!

I don't recall seeing this exception before. Can you provide some more details about the environment the application is running in. For example,

  • ASP.NET Core and version
  • .NET Framework/Core runtime and version
  • OS Version and/or environment

You say this happens on the first Search<T> call. If the AppService/AppDomain/Executable/Process is restarted without making any changes to the code, does it consistently happen on the first call?

Russ, I've been able to create a ticket for this: #00487754

Thanks @mjessee, will coordinate efforts through the ticket :+1:

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.