Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » Error in OrderRepository

Error in OrderRepository

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

On 9.4.2, we're getting this:

System.ArgumentException: Must specify valid information for parsing in the string.
   at System.Enum.EnumResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument)
   at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
   at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
   at Dynamicweb.Ecommerce.Orders.OrderRepository.ExtractOrder(IDataReader reader)
   at Dynamicweb.Ecommerce.Orders.OrderRepository.GetCustomerOrdersByType(Int32 customerId, String shopIds, OrderType orderType, Int32 

Seems like this is the code that causes it:

            If Database.ColumnExists(reader, "OrderShippingCountrySelection") Then
                shippingSelection = DirectCast([Enum].Parse(GetType(CountrySelectionForMethod), Converter.ToString(reader("OrderShippingCountrySelection"))), CountrySelectionForMethod)
            End If
            If Database.ColumnExists(reader, "OrderPaymentCountrySelection") Then
                paymentSelection = DirectCast([Enum].Parse(GetType(CountrySelectionForMethod), Converter.ToString(reader("OrderPaymentCountrySelection"))), CountrySelectionForMethod)
            End If

Should that really be just Database.ColumnExists? What about null values? 

Is there a way to solve this? Should I update the database with fake values for these columns?

Thanks!


Replies

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

Hi Imar,

I don't catch any exception in CC+backend on my test environment based on DW9.4.2, proof, or is it any extra custom coding?

BR, Oleg QA

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Oleg,

No custom code, but custom data. In my database, historical orders are imported from the ERP. These orders don't have a value for OrderShippingCountrySelection and OrderPaymentCountrySelection as those are DW cart specific (they determine which country is used to determine the providers).

I guess the issue is that this new code doesn't take null values into account where I think it should. You can reproduce this by setting the values for OrderShippingCountrySelection and OrderPaymentCountrySelection  to null / empty string in your database and then try again.

Can you take another look?

Thanks!

 
Morten Buhl Dynamicweb Employee
Morten Buhl
Reply

Hi Imar

I've reproduced the problem and bugged it as 46632. Thanks for the report

/Morten

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Thanks Morten!

 

You must be logged in to post in the forum