I'm getting a System.OutOfMemoryException: Array dimensions exceeded supported range. in Microsoft.Extensions.DependencyInjection.ServiceProvider.CaptureDisposable
Which appears to be where the DI tracks the transient services for disposal.
I've recently used the standard DI pipeline to register services and I only have 2 services (controllers) that implement IDisposable
Any ideas?
Update from comments:
public class IoCServicesConfigurator : IServicesConfigurator
{
public void Configure(IServiceCollection serviceCollection)
{
serviceCollection.AddTransient<SiteSearchController>();
}
}
Question
Does the Sitecore ServiceLocator.ServiceProvider.GetService(typeof(...)) reference a IServiceProvider as a per request item?
Sitecore
It looks like the ISitecoreServiceLocatorScope is resolved from the static serviceProvider, ISitecoreServiceLocatorScope is disposable so these references will build over time.
As ServiceLocator.serviceProvider is a static field on a static class I believe the ISitecoreServiceLocatorScopes won't be disposed until the app pool is reset?
Findings
It appears the static application service provider is not releasing Sitecore.DependencyInjection.SitecorePerRequestScopeModule.SitecoreServiceLocatorScope, this is Sitecore version 8.2