nopCommerce 4.30 - Bug fixes and improvements

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 years ago
Sergei-k wrote:
Hi, Boyko.
I understood the problem and will make changes, only we will use the MigrationBase class to search and not the IMigration interface (I hope this level of abstraction will be enough). But even now any migration will be performed, if its assembly is loaded, the main thing is that there would be at least one AutoReverseMigration migration in the assembly, then all other migrations will also be performed.


Hi Sergei,

Yes, it works fine for plugins that have both types of migrations but we have ones that will not have any AutoReverseMigration migrations in them and we need this change for these plugins.
Using the MigrationBase is perfectly fine as we inherit from the Migration class anyway.

p.s: Actually searching for assemblies containing IMigration causes some NullReference exceptions on a clean nopCommerce install in the GetMigrationInfoForMigration method so please have this in mind when you make the changes and make sure it does not break the clean nopCommerce installation process.

Thank you!
Boyko
3 years ago
Hi guys,

Thank you for implementing the change with the MigrationBase!

It works fine on a clean nopCommerce install but there is a problem upgrading from older versions of nopCommerce when you have a migration that needs to be run in any of the plugins.
Actually the problem should exist any time you have a new migration that hasn't been run yet in a plugin i.e when some changes to the plugin are made and it needs to run a new migration on update (the new migration does not have SkipMigrationOnUpdate).
Here is the code that causes the issues where the migrationInfo.Version is a higher number than any of the existing migrations i.e the date of the migration is today.

_migrationRunner.MigrateUp(migrationInfo.Version);


It looks like the migrationRunner code tries to run migrations that are already run as I got this error:

'An error occured executing the following sql:
CREATE INDEX [IX_PCM_ProductId_Extended] ON [dbo].[Product_Category_Mapping] ([ProductId] ASC, [IsFeaturedProduct] ASC) INCLUDE ([CategoryId])
The error was The operation failed because an index or statistics with name 'IX_PCM_ProductId_Extended' already exists on table 'dbo.Product_Category_Mapping'.'


So it tries to run the AddPCMProductIdExtendedIX migration even though it is already present in the MigrationVersionInfo table (added by the nopCommerce upgrade script).

Thanks,
Boyko
3 years ago
Hi, Boyko.
I fixed this problem, please see this commit. Thank you very much for your help.

Nop-Templates.com wrote:


It looks like the migrationRunner code tries to run migrations that are already run as I got this error:

'An error occured executing the following sql:
CREATE INDEX [IX_PCM_ProductId_Extended] ON [dbo].[Product_Category_Mapping] ([ProductId] ASC, [IsFeaturedProduct] ASC) INCLUDE ([CategoryId])
The error was The operation failed because an index or statistics with name 'IX_PCM_ProductId_Extended' already exists on table 'dbo.Product_Category_Mapping'.'


So it tries to run the AddPCMProductIdExtendedIX migration even though it is already present in the MigrationVersionInfo table (added by the nopCommerce upgrade script).
3 years ago
Sergei-k wrote:
Hi, Boyko.
I fixed this problem, please see this commit. Thank you very much for your help.


Hi Sergei,

Thank you for the quick fix!

All seems to be working fine now.

Have a great weekend!

Thanks,
Boyko
3 years ago
Hi,
Thanks for the great work on nopcommerce 4.3 it does look relaly fast.

I am facing an issue, when i reload the plugin list it kills the server. No sure if i am the only one facing it but basically what happens is when we hit the reload list of plugins, when if finishes executing it kills the server presenting the following error:

HTTP Error 503.0 - Server has been shutdown
The service is unavailable.


The same thing happened to me when i did the install, after it it gave the same error.
The  following exception is also being thrown

"
System.OperationCanceledException
  HResult=0x8013153B
  Message=The operation was canceled.
  Source=System.Private.CoreLib
  StackTrace:
   at System.Threading.CancellationToken.ThrowOperationCanceledException()
   at System.Threading.CancellationToken.ThrowIfCancellationRequested()
   at Microsoft.Extensions.Hosting.Internal.Host.<StopAsync>d__10.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<WaitForShutdownAsync>d__5.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
   at Nop.Web.Program.Main(String[] args) in C:\Users\Goncalo\Downloads\nopCommerce_4.30_RC_Source\Presentation\Nop.Web\Program.cs:line 11

"
to illustrate it i did a 2 min (in english) video that you can get from wetransfer.
https://we.tl/t-myUbXBmCKC

If anyone found a similar issue let me know.

Best regards and a great weekend for everyone
3 years ago
gondias wrote:
Hi,
Thanks for the great work on nopcommerce 4.3 it does look relaly fast.

I am facing an issue, when i reload the plugin list it kills the server. No sure if i am the only one facing it but basically what happens is when we hit the reload list of plugins, when if finishes executing it kills the server presenting the following error:

HTTP Error 503.0 - Server has been shutdown
The service is unavailable.


The same thing happened to me when i did the install, after it it gave the same error.
The  following exception is also being thrown

"
System.OperationCanceledException
  HResult=0x8013153B
  Message=The operation was canceled.
  Source=System.Private.CoreLib
  StackTrace:
   at System.Threading.CancellationToken.ThrowOperationCanceledException()
   at System.Threading.CancellationToken.ThrowIfCancellationRequested()
   at Microsoft.Extensions.Hosting.Internal.Host.<StopAsync>d__10.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<WaitForShutdownAsync>d__5.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.<RunAsync>d__4.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
   at Nop.Web.Program.Main(String[] args) in C:\Users\Goncalo\Downloads\nopCommerce_4.30_RC_Source\Presentation\Nop.Web\Program.cs:line 11

"
to illustrate it i did a 2 min (in english) video that you can get from wetransfer.
https://we.tl/t-myUbXBmCKC

If anyone found a similar issue let me know.

Best regards and a great weekend for everyone


Hi, from what i could find in the forums this is a weird issue that doesnt happen if instead we use the nop.web debug profile instead of iisexpress.
3 years ago
Hi guys,

Do you guys plan to implement this (see the comment on the link below):
https://github.com/nopSolutions/nopCommerce/blob/dd4754d8ad3ae27591a7b97434b4e862611bcd2e/src/Presentation/Nop.Web.Framework/Mvc/Routing/SlugRouteTransformer.cs#L148

Currently we are not able to register routes from our plugins that have {SeName} pattern.

Thanks,
Boyko
3 years ago
Nop-Templates.com wrote:
Hi guys,

Do you guys plan to implement this (see the comment on the link below):
https://github.com/nopSolutions/nopCommerce/blob/dd4754d8ad3ae27591a7b97434b4e862611bcd2e/src/Presentation/Nop.Web.Framework/Mvc/Routing/SlugRouteTransformer.cs#L148

Currently we are not able to register routes from our plugins that have {SeName} pattern.


Actually we could register such routes but always the first registered one is picked up, while we have several plugins and entities that have such routes with exactly the same {SeName} pattern only different controllers/actions and thus they are now not working.
So it looks like the comment you have left in the code seems to be the best way to handle this properly for the plugins.

Thank you!
Boyko
3 years ago
Hi

We have developed the Payment Gateway plugin for Nopcommerce 4.2 and the uptake has been pretty good for this plugin.

We have updated the plugin for Nopcommerce 4.3 but have picked up the following bug with Nopcommerce 4.3 RC.

The updated plugin installs successfully in Nopcommerce 4.3, but when you check out and get redirected to the payment gateway you get the following error message:

Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.

The only way to fix this is to add some additional code in the startup.cs file located in the source code version under Presentation/Nop.Web folder.

The additional code is as follows:

using Microsoft.AspNetCore.Server.Kestrel.Core;

and

services.Configure<IISServerOptions>(options =>
            {
                options.AllowSynchronousIO = true;
            });
        }

The full Startup.cs code then looks like below:

using Autofac;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Nop.Core.Configuration;
using Nop.Core.Infrastructure;
using Nop.Web.Framework.Infrastructure.Extensions;

namespace Nop.Web
{
    /// <summary>
    /// Represents startup class of application
    /// </summary>
    public class Startup
    {
        #region Fields

        private readonly IConfiguration _configuration;
        private readonly IWebHostEnvironment _webHostEnvironment;
        private IEngine _engine;
        private NopConfig _nopConfig;

        #endregion

        #region Ctor

        public Startup(IConfiguration configuration, IWebHostEnvironment webHostEnvironment)
        {
            _configuration = configuration;
            _webHostEnvironment = webHostEnvironment;
        }

        #endregion

        /// <summary>
        /// Add services to the application and configure service provider
        /// </summary>
        /// <param name="services">Collection of service descriptors</param>
        public void ConfigureServices(IServiceCollection services)
        {
            (_engine, _nopConfig) = services.ConfigureApplicationServices(_configuration, _webHostEnvironment);
            //Patch for allowing synchronous method required by some Payment Gateways
            services.Configure<IISServerOptions>(options =>
            {
                options.AllowSynchronousIO = true;
            });
        }

        public void ConfigureContainer(ContainerBuilder builder)
        {
            _engine.RegisterDependencies(builder, _nopConfig);
        }

        /// <summary>
        /// Configure the application HTTP request pipeline
        /// </summary>
        /// <param name="application">Builder for configuring an application's request pipeline</param>
        public void Configure(IApplicationBuilder application)
        {
            application.ConfigureRequestPipeline();

            application.StartEngine();
        }
    }
}

Is it possible for this to be included in the final Source and no source version of Nopcommerce 4.3, otherwise we will not be able to provide this plugin to customers.

Trusting for a positive response as I am sure there will be other Payment gateway plugins also affected if this change is not implemented.

regards

Philip
3 years ago
Nop-Templates.com wrote:
...Currently we are not able to register routes from our plugins that have {SeName} pattern

Sure. Here is a work item - https://github.com/nopSolutions/nopCommerce/issues/4698
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.