November Happy Hour will be moved to Thursday December 5th.

Error Creating Product

Vote:
 

Hi,
We are having an issue when you create a new product in Commerce UI, where you hit the plus sign, everything looks good, then you click on the create button and it just, doesn't create.

Looking at chrome developer tools, when I click on the network tab I get the following...

Here is the full error for your information.
Server Error in '/' Application.

Value cannot be null.
Parameter name: source

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.ArgumentNullException: Value cannot be null.
Parameter name: source

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[ArgumentNullException: Value cannot be null.
Parameter name: source]
   System.Linq.Enumerable.Any(IEnumerable`1 source, Func`2 predicate) +289
   System.Linq.WhereEnumerableIterator`1.MoveNext() +239
   System.Linq.Buffer`1..ctor(IEnumerable`1 source) +488
   System.Linq.Enumerable.ToArray(IEnumerable`1 source) +103
   EPiServer.Commerce.Catalog.Provider.Persistence.MetaDataCommitter.UpdateMarketSelection(EntryContentBase content, MetaClass metaClass, MetaObject metaObj) +731
   EPiServer.Commerce.Catalog.Provider.Persistence.MetaDataCommitter.CommitMetaAttributes(T content, Int32 objectId) +1736
   EPiServer.Commerce.Catalog.Provider.Persistence.EntryContentBaseCommitter.CreateNew(EntryContentBase content, Boolean syncDraft) +800
   EPiServer.Commerce.Catalog.Provider.Persistence.EntryContentBaseCommitter.Save(CatalogContentBase content, Boolean syncDraft) +247
   EPiServer.Commerce.Catalog.Provider.CatalogContentCommitterHandler.SaveVersionInternal(CatalogContentBase content, SaveAction action, String currentUser) +744
   EPiServer.Commerce.Catalog.Provider.CatalogContentCommitterHandler.Save(CatalogContentBase content, SaveAction action, String currentUser) +42
   EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.Save(IContent content, SaveAction action) +396
   EPiServer.Core.DefaultContentRepository.Save(IContent content, SaveAction action, AccessLevel access) +444
   EPiServer.Cms.Shell.Service.ContentService.Save(IContent content, SaveAction saveAction) +109
   EPiServer.Cms.Shell.UI.Rest.ContentChangeManager.CreateContent(ContentReference parentLink, Int32 contentTypeId, Nullable`1 resourceFolderId, Boolean createAsLocalAsset, String name, IDictionary`2 properties, SaveAction saveAction) +271
   EPiServer.Cms.Shell.UI.Rest.ContentDataStore.Post(PostContentModel entity) +618
   lambda_method(Closure , ControllerBase , Object[] ) +127
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +242
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
   System.Web.Mvc.Async.<>c__DisplayClass39.b__33() +120
   System.Web.Mvc.Async.<>c__DisplayClass4f.b__49() +452
   System.Web.Mvc.Async.<>c__DisplayClass4f.b__49() +452
   System.Web.Mvc.Async.<>c__DisplayClass37.b__36(IAsyncResult asyncResult) +15
   System.Web.Mvc.Async.<>c__DisplayClass2a.b__20() +31
   System.Web.Mvc.Async.<>c__DisplayClass25.b__22(IAsyncResult asyncResult) +236
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +892
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +1292
   EPiServer.Shell.Services.Rest.RestControllerBase.EndExecute(IAsyncResult asyncResult) +57
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +1303
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +2459
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +1088


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.36366

#178407
May 10, 2017 22:43
Vote:
 

Hey Guys,
Could we get any help or any ideas on how to investigate this issue?

-Paul

#178493
May 11, 2017 19:04
Vote:
 

It looks like the MarketFilter property of the content is null. It should never be (it should be an empty collection if there is no filter). When the content is loaded, it is assigned from the _ExcludedCatalogEntryMarkets meta field. So maybe that field has somehow been lost, had its type changed or similar. 

Is this a new site project, or did this suddely start happening on an existing site? Can you open and edit existing products?

#178495
May 11, 2017 19:42
Vote:
 

You can update existing products just fine, it's just creating new ones that's the issue. Also yes, this is a new site, we just rolled out last month and we had this issue since rolling out.

-Paul

#178538
May 12, 2017 18:58
Vote:
 

We imported all of our products using the catalog manager import tools. They seem to have worked fine, however creating new products aren't working.

Could you or someone explain more in depth what the _ExcludedCatalogEntryMarkets field is, and how I can ensure it has values when creating new products?

-Paul

#178747
May 19, 2017 19:59
Vote:
 

I figured it out! We don't really use the MarketFilter for hiding/showing products on our website, we have a custom property that does this for business reasons.

Because we don't use this field, we had an override on our products class.

[Ignore]
public override ItemCollection<string> MarketFilter { get; set; }

I wouldn't think this would do this, since the parent of my class, VariationContent and ProductContent both enherit this class and it looks identicle. Reguardless, commenting this out fixed the issue.

-Paul

#178748
May 19, 2017 20:36
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.