"There is no method on type QueryableExtensions" error if Solr is down during Sitecore XP restart


Description

Queries against Solr might fail with an unhandled exception after Sitecore XP restarts. The error usually occurs in the GetResults, GetFacets, InContext or Filter methods, for example:

Exception: System.InvalidOperationException
Message: There is no method 'GetResults' on type 'Sitecore.ContentSearch.Linq.QueryableExtensions' that matches the specified arguments
Source: System.Core
   at System.Linq.EnumerableRewriter.FindMethod(Type type, String name, ReadOnlyCollection`1 args, Type[] typeArgs, BindingFlags flags)
   at System.Linq.EnumerableRewriter.VisitMethodCall(MethodCallExpression m)
   at System.Linq.EnumerableExecutor`1.Execute()
at Sitecore.ContentSearch.Linq.QueryableExtensions.GetResults(IQueryable`1 source) ...

Solution

To resolve the issue, consider one of the following options: