Plugin uninstall then install problem in nopCommerce 4.20

4 months ago
I tried to install motion theme and other plugins related to that theme. But after installing those plugins nopCommerce asked to reboot the application .. so I did that.. During rebooting after few minutes it shows error... unable to start application. This problem I am getting in both local machine and hosted server. I noticed in my plugins.json file it is adding some extra data like: pluginToUninstall[....]... pluginToDelete[....] (Approximately). nopCommerce team help me out with this problem....
4 months ago
can you please share your error log so we know where is the problem?
or please share some detail about this error
4 months ago
Again I tried to uninstall one plugin. Then I restarted the application. During reboot visual studio stopped. Now my plugins.json looks like this :
{
  "InstalledPluginNames": [
    "DiscountRequirement.MustBeAssignedToCustomerRole",
    "CurrencyExchange.ECB",
    "Misc.SendinBlue",
    "Payments.CheckMoneyOrder",
    "Payments.Manual",
    "Payments.PayPalStandard",
    "Payments.Qualpay",
    "Payments.Square",
    "Pickup.PickupInStore",
    "Shipping.FixedByWeightByTotal",
    "Shipping.UPS",
    "Tax.Avalara",
    "Tax.FixedOrByCountryStateZip",
    "Widgets.GoogleAnalytics",
    "Widgets.NivoSlider",
    "ExternalAuth.Facebook",
    "Misc.SolrOverride",
    "SevenSpikes.Core",
    "SevenSpikes.Nop.Plugins.AjaxFilters",
    "SevenSpikes.Nop.Plugins.AnywhereSliders",
    "SevenSpikes.Nop.Plugins.CloudZoom",
    "SevenSpikes.Nop.Plugins.FacebookShop",
    "SevenSpikes.Nop.Plugins.InstantSearch",
    "SevenSpikes.Nop.Plugins.JCarousel",
    "SevenSpikes.Nop.Plugins.MegaMenu",
    "SevenSpikes.Nop.Plugins.NopQuickTabs",
    "SevenSpikes.Nop.Plugins.ProductRibbons",
    "SevenSpikes.Nop.Plugins.QuickView",
    "SevenSpikes.Theme.Motion"
  ],
  "PluginNamesToUninstall": [
    "SevenSpikes.Nop.Plugins.CloudZoom"
  ],
  "PluginNamesToDelete": [],
  "PluginNamesToInstall": []
}



These lines added : ,
  "PluginNamesToUninstall": [
    "SevenSpikes.Nop.Plugins.CloudZoom"
  ],
  "PluginNamesToDelete": [],
  "PluginNamesToInstall": []


Now in Admin --> Local plugins... It looks like that plugin did not uninstall.
Again it is showing uninstall option for that plugin
4 months ago
Now I tried to install that plugin. And I got this Error in



An error occurred while starting the application.
NullReferenceException: Object reference not set to an instance of an object.

Microsoft.AspNetCore.Authentication.AuthenticationHttpContextExtensions.AuthenticateAsync(HttpContext context, string scheme)

    NullReferenceException: Object reference not set to an instance of an object.
        Microsoft.AspNetCore.Authentication.AuthenticationHttpContextExtensions.AuthenticateAsync(HttpContext context, string scheme)
        Nop.Services.Authentication.CookieAuthenticationService.GetAuthenticatedCustomer() in CookieAuthenticationService.cs

                var authenticateResult = _httpContextAccessor.HttpContext.AuthenticateAsync(NopAuthenticationDefaults.AuthenticationScheme).Result;

Nop.Web.Framework.WebWorkContext.get_CurrentCustomer() in WebWorkContext.cs

                        customer = _authenticationService.GetAuthenticatedCustomer();

Nop.Web.Framework.WebWorkContext.get_WorkingLanguage() in WebWorkContext.cs

                    var customerLanguageId = _genericAttributeService.GetAttribute<int>(CurrentCustomer,

Nop.Services.Localization.LocalizationService.GetResource(string resourceKey) in LocalizationService.cs

                if (_workContext.WorkingLanguage != null)

Nop.Services.Plugins.PluginService.InstallPlugins() in PluginService.cs

                        var message = string.Format(localizationService.GetResource("Admin.Plugins.Errors.NotInstalled"), descriptor.SystemName);

Nop.Web.Framework.Infrastructure.Extensions.ServiceCollectionExtensions.ConfigureApplicationServices(IServiceCollection services, IConfiguration configuration, IHostingEnvironment hostingEnvironment) in ServiceCollectionExtensions.cs

                engine.Resolve<IPluginService>().InstallPlugins();

Nop.Web.Startup.ConfigureServices(IServiceCollection services) in Startup.cs

                    return services.ConfigureApplicationServices(_configuration, _hostingEnvironment);
    Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
    Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
    Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize()
    Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()


.NET Core 4.6.27110.04 X64 v4.0.0.0    |   Microsoft.AspNetCore.Hosting version 2.2.0-rtm-35687    |    Microsoft Windows 10.0.17134    |   Need help?



And my plugins.json looks like this :

{
  "InstalledPluginNames": [
    "DiscountRequirement.MustBeAssignedToCustomerRole",
    "CurrencyExchange.ECB",
    "Misc.SendinBlue",
    "Payments.CheckMoneyOrder",
    "Payments.Manual",
    "Payments.PayPalStandard",
    "Payments.Qualpay",
    "Payments.Square",
    "Pickup.PickupInStore",
    "Shipping.FixedByWeightByTotal",
    "Shipping.UPS",
    "Tax.Avalara",
    "Tax.FixedOrByCountryStateZip",
    "Widgets.GoogleAnalytics",
    "Widgets.NivoSlider",
    "ExternalAuth.Facebook",
    "Misc.SolrOverride",
    "SevenSpikes.Core",
    "SevenSpikes.Nop.Plugins.AjaxFilters",
    "SevenSpikes.Nop.Plugins.AnywhereSliders",
    "SevenSpikes.Nop.Plugins.FacebookShop",
    "SevenSpikes.Nop.Plugins.InstantSearch",
    "SevenSpikes.Nop.Plugins.JCarousel",
    "SevenSpikes.Nop.Plugins.MegaMenu",
    "SevenSpikes.Nop.Plugins.NopQuickTabs",
    "SevenSpikes.Nop.Plugins.ProductRibbons",
    "SevenSpikes.Nop.Plugins.QuickView",
    "SevenSpikes.Theme.Motion"
  ],
  "PluginNamesToUninstall": [],
  "PluginNamesToDelete": [],
  "PluginNamesToInstall": [
    {
      "Item1": "SevenSpikes.Nop.Plugins.CloudZoom",
      "Item2": "ced45d4c-72cb-4c4f-9d3d-80081d404d60"
    }
  ]
}
4 months ago
Did you manage to resolve this issue? I am getting the same issue in production
4 months ago
You need to remove the plugin by removing the Error Plugin in the file: ,
  "PluginNamesToUninstall": [
  ],
  "PluginNamesToDelete": [],
  "PluginNamesToInstall": []

Then you need to restart the application for the removal to complete. I also met the same problem as you.
1 month ago
Any solution? I have the same problem.. the solution is not the removal of plugin: plugin is mandatory for our site.

Thanks
1 month ago
I had this exact same problem, both on a staging server, as well as on my local dev machine.

I've fixed it locally but have as of yet done anything else with it (such as create a pull request or submit a bug for it with the resolution)

So - if you are able to compile with changes, then the issue is with method GetAuthenticatedCustomer in
Libraries\Nop.Services\Authentication\CookieAuthenticationService.cs

Line 101 is
            var authenticateResult = _httpContextAccessor.HttpContext.AuthenticateAsync(NopAuthenticationDefaults.AuthenticationScheme).Result;

But _httpContextAccessor.HttpContext is null at the point of plugin install in this case.

My first attempt (which worked) was to add the following lines immediately before the above line

  if (_httpContextAccessor.HttpContext == null)
            {
                return null;
            }
1 month ago
I solved the issue adding a backroud syste customer into Customer table. I suppose that during an upgrade from 3.9 to 4.2 something went wrong and we had this type of issue.
Adding manually a record for this user issue is solved!
1 month ago
Hi Massimo,
could you tell me what features the user should have?

Where do you enter it? directly from the DB?

thanks
marco

zrmax wrote:
I solved the issue adding a backroud syste customer into Customer table. I suppose that during an upgrade from 3.9 to 4.2 something went wrong and we had this type of issue.
Adding manually a record for this user issue is solved!