Developer forum

Forum » Development » User.save > Dynamicweb.Ecommerce.Common.Context.GetCart() throws NullReferenceException

User.save > Dynamicweb.Ecommerce.Common.Context.GetCart() throws NullReferenceException

Gaëtan Di Caro
Reply

Hello,

I'm trying to execute some code after my user import to update some custom fields, but I get a NullReferenceException when I try to call the Save() method :

user.CustomFieldValues.FirstOrDefault(x => x.CustomField.SystemName == "AccessUser_MyField").Value = value;
user.Save();

Which leads to :

Object reference not set to an instance of an object.
   at Dynamicweb.Ecommerce.Common.Context.GetCart()
   at Dynamicweb.Ecommerce.Cart.UserSavedSubscriber.OnNotify(String notification, NotificationArgs args)
   at Dynamicweb.Extensibility.Notifications.NotificationManager.Notify(String notification, NotificationArgs eventArgs)
   at Dynamicweb.Security.UserManagement.User.Save()

Any idea where that can come from ?


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

That sounds like TFS#42247 that was fixed in 9.3.8

Votes for this answer: 1
 
Gaëtan Di Caro
Reply

Thanks, that was it. I updated and it's fine now.

 

You must be logged in to post in the forum