Last active
October 6, 2019 03:03
-
-
Save markgibbons25/ab3fa332b5048adbcc8cec30a7c7aedf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RegisterDependencies : Sitecore.DependencyInjection.BaseServiceProviderBuilder | |
{ | |
protected override IServiceProvider BuildServiceProvider(IServiceCollection serviceCollection) | |
{ | |
// FIX FOR https://github.com/aspnet/AspNetCore/issues/2737 | |
var options = new ServiceProviderOptions(); | |
var type = options.GetType(); | |
var propertyInfo = type.GetProperty("Mode", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); | |
propertyInfo.SetValue(options, 1); // SET TO RUNTIME | |
return serviceCollection.BuildServiceProvider(options); | |
} | |
} | |
Patch as follows: | |
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> | |
<sitecore> | |
<serviceProviderBuilder> | |
<patch:attribute name="type" value="Foundation.DependencyInjection.DI.RegisterDependencies, Foundation.DependencyInjection" /> | |
</serviceProviderBuilder> | |
</sitecore> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment