nopCommerce 4.60 - Bug fixes and improvements

Hace 1 año
Hi, Boyko. I found the problematic code and escaped it, in version 4.70 we will rework the problematic code section

Nop-Templates.com wrote:
Hi, Boyko. I was able to reproduce the problem you described and will try to understand its causes, here is a ticket to track the status.

Thank you, Sergei!

Thanks,
Boyko
Hace 1 año
Sergei-k wrote:
Hi, Boyko. I found the problematic code and escaped it, in version 4.70 we will rework the problematic code section


Hi Sergei,

Thank you for the fix!

I agree about the refactoring as the migrations are a bit mistery to me .
I used to use the cool migration types i.e Update etc. but it didn't work as there are checks in the code that are written in a way that expect only nopCommerce itself to use them and not being used by plugins. For example this code checks if the migration name starts with the Update and simply ignores the migration (at the same time if you use the Update type you don't specify a description and your plugin migration get ignored).

migrationInfo.Description.StartsWith(string.Format(NopMigrationDefaults.UpdateMigrationDescriptionPrefix, NopVersion.FULL_VERSION


So I simply gave up using these parameters and sticked to the defaults.
Anyway if you make a refactoring,  it will be nice to have more detailed explanation in which case we are safe to use which parameters to the migration attribute from the plugins.

Since the code change you made is in the Core nopCommerce, this will require a new minor version of nopCommerce i.e 4.6.1 as otherwise no one can install plugins (that have db migration) with the current version of nopCommerce 4.6.0. As I said none of our plugins that have db access could be installed by our clients in 4.6.

Do you plan to release a new minor version of nopCommerce any time soon?

Thanks,
Boyko
Hace 1 año
Nop-Templates.com wrote:
Do you plan to release a new minor version of nopCommerce any time soon?

Yes, we plan to release it the next week
Hace 1 año
Here is a pretty big PR, from Rickard, with caching improvements https://github.com/nopSolutions/nopCommerce/pull/6531

- Bug fixes
- Performance enhancements
- New Redis-synchronised memory cache (this makes distributed cache as performant as the memory cache)
- Support for background tasks

Would be really awesome if this could make it to 4.60 as well.
Hace 1 año
Hello,
There is a  'unhandled exception' after changing the setting  'Pictures are stored into...' from db to file system in settings -> media seetings. Works fine after several refreshes.


An unhandled exception occurred while processing the request.
IOException: The process cannot access the file 'C:\Users\ciuss\source\repos\nopCommerce_4.60.2_Source\Presentation\Nop.Web\wwwroot\images\0000020_0.jpeg' because it is being used by another process.
Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(string fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)

Stack Query Cookies Headers Routing
IOException: The process cannot access the file 'C:\Users\ciuss\source\repos\nopCommerce_4.60.2_Source\Presentation\Nop.Web\wwwroot\images\0000020_0.jpeg' because it is being used by another process.
Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(string fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
Microsoft.Win32.SafeHandles.SafeFileHandle.Open(string fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, long preallocationSize, Nullable<UnixFileMode> unixCreateMode)
System.IO.File.<WriteAllBytesAsync>g__Core|92_0(string path, byte[] bytes, CancellationToken cancellationToken)
Nop.Core.Infrastructure.NopFileProvider.WriteAllBytesAsync(string filePath, byte[] bytes) in NopFileProvider.cs
+
            await File.WriteAllBytesAsync(filePath, bytes);
Nop.Services.Media.PictureService.SavePictureInFileAsync(int pictureId, byte[] pictureBinary, string mimeType) in PictureService.cs
+
            await _fileProvider.WriteAllBytesAsync(await GetPictureLocalPathAsync(fileName), pictureBinary);
Nop.Services.Media.PictureService.UpdatePictureAsync(int pictureId, byte[] pictureBinary, string mimeType, string seoFilename, string altAttribute, string titleAttribute, bool isNew, bool validateBinary) in PictureService.cs
+
                await SavePictureInFileAsync(picture.Id, pictureBinary, mimeType);
Nop.Services.Media.PictureService.GetPictureUrlAsync(Picture picture, int targetSize, bool showDefaultPicture, string storeLocation, PictureType defaultPictureType) in PictureService.cs
+
                picture = await UpdatePictureAsync(picture.Id,
Nop.Web.Factories.ProductModelFactory+<>c__DisplayClass45_0+<<PrepareProductOverviewPicturesModelAsync>g__preparePictureModelAsync|2>d.MoveNext() in ProductModelFactory.cs
+
                    var picResultTasks = await Task.WhenAll(_pictureService.GetPictureUrlAsync(picture, pictureSize), _pictureService.GetPictureUrlAsync(picture));
Nop.Web.Factories.ProductModelFactory+<>c__DisplayClass45_0+<<PrepareProductOverviewPicturesModelAsync>b__3>d.MoveNext() in ProductModelFactory.cs
+
                    .SelectAwait(async picture => await preparePictureModelAsync(picture))
System.Threading.Tasks.ValueTask<TResult>.get_Result()
System.Linq.AsyncEnumerable+SelectEnumerableAsyncIteratorWithTask<TSource, TResult>.MoveNextCore() in Select.cs
System.Linq.AsyncIteratorBase<TSource>.MoveNextAsync() in AsyncIterator.cs
System.Linq.AsyncIteratorBase<TSource>.MoveNextAsync() in AsyncIterator.cs
System.Linq.AsyncEnumerable.<ToListAsync>g__Core|424_0<TSource>(IAsyncEnumerable<TSource> source, CancellationToken cancellationToken) in ToList.cs
System.Linq.AsyncEnumerable.<ToListAsync>g__Core|424_0<TSource>(IAsyncEnumerable<TSource> source, CancellationToken cancellationToken) in ToList.cs
System.Threading.Tasks.ValueTask<TResult>.get_Result()
Nop.Web.Factories.ProductModelFactory+<>c__DisplayClass45_0+<<PrepareProductOverviewPicturesModelAsync>b__1>d.MoveNext() in ProductModelFactory.cs
+
                var pictureModels = await pictures
Nop.Core.Caching.MemoryCacheManager.GetAsync<T>(CacheKey key, Func<Task<T>> acquire) in MemoryCacheManager.cs
+
            result = await acquire();
Nop.Web.Factories.ProductModelFactory.PrepareProductOverviewPicturesModelAsync(Product product, Nullable<int> productThumbPictureSize) in ProductModelFactory.cs
+
            var cachedPictures = await _staticCacheManager.GetAsync(cacheKey, async () =>
Nop.Web.Factories.ProductModelFactory.PrepareProductOverviewModelsAsync(IEnumerable<Product> products, bool preparePriceModel, bool preparePictureModel, Nullable<int> productThumbPictureSize, bool prepareSpecificationAttributes, bool forceRedirectionAfterAddingToCart) in ProductModelFactory.cs
+
                    model.PictureModels = await PrepareProductOverviewPicturesModelAsync(product, productThumbPictureSize);
Nop.Web.Components.HomepageProductsViewComponent.InvokeAsync(Nullable<int> productThumbPictureSize) in HomepageProductsViewComponent.cs
+
            var model = (await _productModelFactory.PrepareProductOverviewModelsAsync(products, true, true, productThumbPictureSize)).ToList();
Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsyncCore(ObjectMethodExecutor executor, object component, ViewComponentContext context)
Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsync(ViewComponentContext context)
Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsync(ViewComponentContext context)
Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentHelper.InvokeCoreAsync(ViewComponentDescriptor descriptor, object arguments)
AspNetCore.Views_Home_Index.ExecuteAsync() in Index.cshtml
+
        @await Component.InvokeAsync(typeof(HomepageProductsViewComponent))


Thanks,
Ciussky
Hace 10 meses
Running into the same IOException as Ciussky in 4.60.2 on category pages.  Refreshing 3-4 times makes it go away.  Has this been addressed in 4.60.3?
Hace 10 meses
Resolved in 4.60.3
https://github.com/nopSolutions/nopCommerce/issues/6602