-
Notifications
You must be signed in to change notification settings - Fork 121
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
NullReferenceException Sitecore 9.3 build #410
Comments
Are one of the scoped instances disposing the singleton instance? |
Hi Mike, We're experienced this very exact issue with Glass Mapper 5.8.170 on Sitecore 9.3.0. Are you aware of any workarounds or estimate of when this will be fixed? Thank you in advance, |
This is probably a disposal of the SitecoreService before it should have been. You need to check the lifecycle of the object and see if you have anything disposing the service incorrectly. Check your IOC registrations as well.. |
Hi. We are experiencing this now as well on a Sitecore 9.3 installation running Glass.Mapper.Sc.93 (5.6.160). |
@webbson You need check if you have any service registered as Singleton and check if they are depending on ISitecoreService (or any service which uses ISitecoreService, e.g IRequestContext etc) I had exactly the same issue on Sitecore V10.1. (and I had a singleton service, using IRequestContext, which uses ISitecoreService) |
Hi, we have encountered null exceptions, which I think is related to Sitecore context being lost on Singleton lifecycle, and currently it is only misbehaving on CM, and requires restarting CM.
Might be related to these posts, but I would've thought the issue would've been addressed in latest version.
#340
#374
Version: Glass.Mapper.Sc.93 (5.6.160)
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Glass.Mapper.Sc
at Glass.Mapper.Sc.GetItemByIdOptions.GetItem(Database database) in C:\TeamCity\buildAgent\work\9693a2d38f55a4a\Source\Glass.Mapper.Sc:line 51
at Glass.Mapper.Sc.SitecoreService.GetItem(GetItemOptions options) in C:\TeamCity\buildAgent\work\9693a2d38f55a4a\Source\Glass.Mapper.Sc\SitecoreService.cs:line 336
at Glass.Mapper.Sc.SitecoreService.GetItem[T](GetItemOptions options) in C:\TeamCity\buildAgent\work\9693a2d38f55a4a\Source\Glass.Mapper.Sc\SitecoreService.cs:line 320
Code,
serviceCollection.AddSingleton<Func<Database, ISitecoreService>>(_ => CreateSitecoreService);
serviceCollection.AddScoped(_ => CreateSitecoreContextService());
serviceCollection.AddScoped(_ => CreateRequestContext());
serviceCollection.AddScoped(_ => CreateGlassHtml());
serviceCollection.AddScoped(_ => CreateMvcContext());
serviceCollection.AddScoped(_ => CreateWebFormsContext());
The text was updated successfully, but these errors were encountered: