Multiple guest roles gets created

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 years ago
If as coders we've done something wrong to cause issue this then is it possible to provide some information for creating plugins so that this problem doesn't happen -  this is enormously scary as I bet it's related to the changes that caused the DbContext is disposed issue.  we have actually had a knock on issue regarding orders created by customers as a guest, (the payment came but nop didn't confirm the order so it was stuck in their ShoppingCartItems without an order - we have disabled checkout as guest and it's not happening now - but we want check out as guest but cannot re-instate it as this issue is not resolved.

It's difficult to understand that "it's our own fault", and without any guidelines it's getting more more complicated. I define the problem as that nop is creating database entries on it's own, and I can't actually confirm to my clients that everything is ok and that it's not doing this to other areas in the database - seriously, I can't confirm this.

maybe it's an upgrade issue, maybe it's to do with the optimizations.
9 years ago
OK, to put an end to this - I've realized that nop is even more awesome now, yes the plugins were at fault, but generally due to the 3.4 upgrade - It's taken a while to catch up with you...

If any other plugin programmers have these errors I suggest to do what I did - install nop on sql compact and try it there - I was able to trace quite a few errors that crept into my plugins (due to to changes :-) including the dreaded "Object has been disposed" and even quite a few "Loader Locks" - I was able to fully understand the why's and where's using sql compact as it seems to complain a lot more lol - so I guess I'm lucky this time - I hope this debugging technique can help other coders stuck at this point. I didn't find specifically what why problem was, but I fixed all the funnies and it doesn't re-create those database entries that already existed. There were "internal" exceptions being fired, I only noticed this because some of the processes were slowing down, I twigged that it was throwing exceptions internally, but the logging didn't catch them as they were deeper than that - The structure of nop is great so there will be no more complaints from me :-) - I'm lucky I understand the errors I was getting, tracing them was the difficulty.
9 years ago
I'm also facing the same problem. I tried restoring and executing the upgrade script but it did not fix.

I don't know is it related but while debugging app 8-10 errors logged to console which does not prevent application from running.

System.NullReferenceException: Object reference not set to an instance of an object.
   at Nop.Services.Helpers.UserAgentHelper.IsSearchEngine() in \\psf\home\Documents\Source\Repos\nopcommerce\Libraries\Nop.Services\Helpers\UserAgentHelper.cs:line 67
9 years ago
I experienced this same problem on an implementation started from 3.40 that's been modified but mostly within the guidelines to allow ease of upgrade to future versions.

My issue was due to our own implementation of an ICacheManager that was added to Autofac's registration after Nop.Web.Framework.DependencyRegistrar.

The comment from Andrei in this thread led me to resolving my issue due to the fact that the CustomerService's ICacheManager should resolve to the PerRequestCacheManager, in which is implicit if only looking at the Nop.Web.Framework.DependencyRegistrar.


To resolve, I placed a duplicate registration of


builder.RegisterType<PerRequestCacheManager>().As<ICacheManager>().Named<ICacheManager>("nop_cache_per_request").InstancePerLifetimeScope();


after my own ICacheManager implementation allowing it to be the most recent registration for ICacheManager which Autofac will by default use for any implicit dependencies.
9 years ago
I experienced this same problem on an implementation started from 3.40 that's been modified but mostly within the guidelines to allow ease of upgrade to future versions.

My issue was due to our own implementation of an ICacheManager that was added to Autofac's registration after Nop.Web.Framework.DependencyRegistrar.

The comment from Andrei in this thread led me to resolving my issue due to the fact that the CustomerService's ICacheManager should resolve to the PerRequestCacheManager, in which is implicit if only looking at the Nop.Web.Framework.DependencyRegistrar.


To resolve, I placed a duplicate registration of


builder.RegisterType<PerRequestCacheManager>().As<ICacheManager>().Named<ICacheManager>("nop_cache_per_request").InstancePerLifetimeScope();


after my own ICacheManager implementation allowing it to be the most recent registration for ICacheManager which Autofac will by default use for any implicit dependencies.
9 years ago
So, is this a serious issue to the functionality of NOP 3.40?!

We have been working on this version for a very long time and its very difficult at the time being to upgrade to 3.50

I only have a handful of "Gust" Customer roels 7 to be exact, Can I just deleted manually?!  is it Safe?!

does this effect anything serious such as orders?!

Please let me know, I'm not a programmer and not even running the one with source.


I would apreciate all the feedback
9 years ago
We're in the same position regarding 3.40

To clean these Guest Roles manually you will need "some" sql knowledege:

In Sql you will need to get the 'Id' of the latest 'Guest Role' that was created, view the CustomerRole table and get the value manually - mine was 335

I also suggest checking that the Guests Role has an Id of 4 - see the script:

Run these:


use [<your database name>]
update Customer_CustomerRole_Mapping
set CustomerRole_Id = 4
where CustomerRole_Id > 334



use [<your database name>]
delete from CustomerRole
where Id > 334


It will set the role back to Guest for any that are the new Guest role, and then delete the extra roles.
9 years ago
I haven't noticed anything serious regarding this issue - I thought I'd fixed it ;-) but we get a few here and there, we don't allow checking out as guest, but even if you do I don't think it really matters  - i "don't think" nop minds there being more roles - we tell our clients that it's just a "cosmetic" issue that we'll fix at some point ;-)
9 years ago
It smells like it has something to do with custom built plugins. We are running "simple" shops, without any special custom built plugins, in both 3.40 and 3.50 versions of Nop without having the issue with multiple Guest (CustomerRole) created.

In a more advanced Nop 3.50 shop with many custom built plugins, I can recreate the error. For example, every time a new Guest (user) is created, for example when you log out, a new Guests (CustomerRole) is created and mapped to this new guest user. Maybe it's just cosmetic, I don't know, but I'll bet there will be perfomance issues when this table starts to grow and you would like to update the ACL for example.

/Marcus
9 years ago
In response to my last post. We managed to isolate the error to just one (custom built) plugin. We don't know today exactly why this error occured but after totaly removing the plugin and then rebuilt if from the bottom up we never experienced this problem again.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.