If "Show the number of distinct products besides each category" is checked, then I get below error when selecting a leaf node in category tree (my categories are 3 levels deep)
It appears as this is being called for the leaf node, and then all siblings of the leaf node too. exec ProductLoadAllPaged (Only occurs if showing number of products)
----------- An object with the same key already exists in the ObjectStateManager. The ObjectStateManager cannot track multiple objects with the same key.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: An object with the same key already exists in the ObjectStateManager. The ObjectStateManager cannot track multiple objects with the same key.
Source Error:
Line 121: var result = context.Translate<TEntity>(reader).ToList(); Line 122: foreach (var entity in result) Line 123: Set<TEntity>().Attach(entity); Line 124: //close up the reader, we're done saving results Line 125: reader.Close();
You're absolutely right. The issue is 'NopObjectContext' class ('ExecuteStoredProcedureList' method). After entity is read from the database, it's attached to the context: Set<TEntity>().Attach(entity); (line 123). We should ensure that it's not already attached. I don't know how to fix it right now, but I'll investigate it a bit later
UPDATE: But you can simply comment the following source and it'll work:
foreach (var entity in result) Set<TEntity>().Attach(entity);
Same error occurs when just "Show the number of distinct products besides each category" is selected while "Include subcategories (number of distinct products)" is not selected AND now you step to the public store and click on one of the sample "SUB-Categories". When you just click a main category, the error does not occur.
Is there a build with this fix? I do not have VS2010 to compile and the deploy script will not build due to errors.
Build FAILED.
"C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\build\nop.proj" (default target) (1) -> "C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\NopCommerce.sln" (default target) (2) -> "C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\Libraries\Nop.Core\Nop.Core.csproj" (default target) (3) -> (ResolveAssemblyReferences target) -> c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.Mvc". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\Libraries\N op.Core\Nop.Core.csproj]
"C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\build\nop.proj" (default target) (1) -> "C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\NopCommerce.sln" (default target) (2) -> "C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\Presentation\Nop.Web\Nop.Web.csproj" (default target ) (24) -> C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\Presentation\Nop.Web\Nop.Web.csproj(1297,3): error MSB4019: The imported project "C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.target s" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
"C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\build\nop.proj" (default target) (1) -> "C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\NopCommerce.sln" (default target) (2) -> "C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\Presentation\Nop.Web\Administration\Nop.Admin.csproj " (default target) (25) -> C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\Presentation\Nop.Web\Administration\Nop.Admin.cspro j(960,3): error MSB4019: The imported project "C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
"C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\build\nop.proj" (default target) (1) -> "C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\NopCommerce.sln" (default target) (2) -> "C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\Libraries\Nop.Core\Nop.Core.csproj" (default target) (3) -> (CoreCompile target) -> Fakes\FakeHttpRequest.cs(4,18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) [C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\Libraries\Nop.Core\Nop.Core.csproj]
Is there a build with this fix? I do not have VS2010 to compile and the deploy script will not build due to errors.
Build FAILED.
"C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\build\nop.proj" (default target) (1) -> "C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\NopCommerce.sln" (default target) (2) -> "C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\Libraries\Nop.Core\Nop.Core.csproj" (default target) (3) -> (ResolveAssemblyReferences target) -> c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.Mvc". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\Libraries\N op.Core\Nop.Core.csproj]
"C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\build\nop.proj" (default target) (1) -> "C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\NopCommerce.sln" (default target) (2) -> "C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\Presentation\Nop.Web\Nop.Web.csproj" (default target ) (24) -> C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\Presentation\Nop.Web\Nop.Web.csproj(1297,3): error MSB4019: The imported project "C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.target s" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
"C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\build\nop.proj" (default target) (1) -> "C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\NopCommerce.sln" (default target) (2) -> "C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\Presentation\Nop.Web\Administration\Nop.Admin.csproj " (default target) (25) -> C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\Presentation\Nop.Web\Administration\Nop.Admin.cspro j(960,3): error MSB4019: The imported project "C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
"C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\build\nop.proj" (default target) (1) -> "C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\NopCommerce.sln" (default target) (2) -> "C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\Libraries\Nop.Core\Nop.Core.csproj" (default target) (3) -> (CoreCompile target) -> Fakes\FakeHttpRequest.cs(4,18): error CS0234: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) [C:\Users\luser\Downloads\nopcommerce-9da05e4bc0e2\nopCommerce_9da05e4bc0e2\src\Libraries\Nop.Core\Nop.Core.csproj]
It will be easy for a developer, if you say which file, we need to change in the original source, since we already have changed some controller classes.
It will be easy for a developer, if you say which file, we need to change in the original source, since we already have changed some controller classes.
Just click on the link I provided above. It contains a list of changed files and appropriate changes
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.