Get an error when saving Payment Plan as Purchase Order for Subscriptions

Vote:
 

Hi All,

We are going to enbale the Subscription Orders as a feature and was able to create Subscription Orders based on the Items in the Cart. Please see below image 

But when runs Process Subscription job, it throws an error as "Cannot add the same member twice to a SerializationInfo object" when it goes to execute "SaveAsPurchaseOrder" method for that Payment Plan. The highlighted line is the one throwing that error.

I spent considerable time to fix this error, but still no hope. Could you please help me to solve this error?

Thank you.

Nalin

#254409
May 06, 2021 4:46
Vote:
 

What is the full stacktrace of this?

#254411
May 06, 2021 7:04
Vote:
 

Hi Quan,

Please see the stack trace for this error

   at System.Runtime.Serialization.SerializationInfo.AddValueInternal(String name, Object value, Type type) in f:\dd\ndp\clr\src\BCL\system\runtime\serialization\serializationinfo.cs:line 416
   at System.Runtime.Serialization.SerializationInfo.AddValue(String name, Object value, Type type) in f:\dd\ndp\clr\src\BCL\system\runtime\serialization\serializationinfo.cs:line 302
   at System.Runtime.Serialization.SerializationInfo.AddValue(String name, Object value) in f:\dd\ndp\clr\src\BCL\system\runtime\serialization\serializationinfo.cs:line 313
   at Mediachase.Commerce.Storage.MetaStorageBase.GetObjectData(SerializationInfo info, StreamingContext context)
   at Mediachase.Commerce.Orders.OrderStorageBase.GetObjectData(SerializationInfo info, StreamingContext context)
   at Mediachase.Commerce.Orders.OrderAddress.GetObjectData(SerializationInfo info, StreamingContext context)
   at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) in f:\dd\ndp\clr\src\BCL\system\runtime\serialization\formatters\binary\binaryobjectinfo.cs:line 159
   at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) in f:\dd\ndp\clr\src\BCL\system\runtime\serialization\formatters\binary\binaryobjectinfo.cs:line 110
   at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) in f:\dd\ndp\clr\src\BCL\system\runtime\serialization\formatters\binary\binaryobjectwriter.cs:line 202
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) in f:\dd\ndp\clr\src\BCL\system\runtime\serialization\formatters\binary\binaryformatter.cs:line 235
   at Mediachase.Commerce.Storage.MetaStorageBase.Clone()
   at Mediachase.Commerce.Orders.PaymentPlan.SaveAsPurchaseOrder()
   at EPiServer.Commerce.Order.Internal.PaymentPlanProvider.SaveAsPurchaseOrder(IPaymentPlan paymentPlan)
   at EPiServer.Commerce.Order.Internal.DefaultOrderRepository.SaveAsPurchaseOrder(IOrderGroup cart)
   at GreenCrossHealth.EpiServer.Core.ScheduleJobs.ProcessSubscriptionOrders.ProcessPaymentPlan(PaymentPlan plan) in C:\LEVO\Repos\gxh-latest\green-cross-ecommerce\Source\GreenCrossHealth.EpiServer.Core\ScheduleJobs\ProcessSubscriptionOrders.cs:line 102

Thank you

Nalin

#254418
May 06, 2021 8:21
Vote:
 

does it happen to all payment plans, or just specific ones? it looks like you should look into the address attached to them, probably faulty data there

#254419
May 06, 2021 8:23
Vote:
 

Hi Quan,

Yes, its happening to all Subscription Orders. And below is the information related ShippingAddress for one of the fail Subscription Order

Seem its ok to me. Could you spot any errouneous data available here? Or other than this any data/property that I need to check here?

Since I stuck on this from yesterday onwards, could you please help me to fix this issue?

Thank in advance.

Nalin

#254428
May 06, 2021 9:39
Vote:
 

Try expand _fieldStorage, that's where you store your custom properties. something might be hidden in there.

If you want a guaranteed answer, your best bet is to contact developer support service. I try to help as much as I can, but my time is quite limited and I might run away from a complex problem.

#254429
Edited, May 06, 2021 9:48
Vote:
 

Hi Quan,

Values for _fieldStorage is as below

Thanks

Nalin

#254432
May 06, 2021 10:05
Vote:
 

I think that's the problem, you have two State properties (one as property of IOrderAddress, and one as your custom one). 

#254433
May 06, 2021 10:07
Vote:
 

Hi Quan,

Did you mean these 2 fields?

Thanks

Nalin

#254436
May 06, 2021 10:25
Vote:
 

Yes

#254437
May 06, 2021 10:26
* 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.