Bukimedia / PrestaSharp

CSharp .Net client library for the PrestaShop API via web service
GNU General Public License v3.0
155 stars 151 forks source link

I can't list orders anymore, error: 'Value cannot be null. Parameter name: source' #405

Closed danicodeRO closed 4 years ago

danicodeRO commented 4 years ago

Library Version:

1.1.0 RestSharp: 106.11.4

Prestashop version:

1.6.1.23

Describe the Bug:

When I tried to download the orders, now I get the error:

System.ArgumentNullException: 'Value cannot be null. Parameter name: source'

To Reproduce: The code on the guide, my code is in Vb.Net. It worked, but I think is because of updates.

       Dim mag As Magazin = f.Magazinul(IdMagazin)

        Dim p As New ManufacturerFactory(mag.Adresa, mag.parola, "")
        Dim o As New OrderFactory(mag.Adresa, mag.parola, "")

        Dim filter As Dictionary(Of String, String) = New Dictionary(Of String, String)()
        Dim dFrom As String = String.Format("{0:yyyy-MM-dd HH:mm:ss}", dataInceput)
        Dim dTo As String = String.Format("{0:yyyy-MM-dd HH:mm:ss}", dataSfarsit)
        filter.Add("date_add", "[" & dFrom & "," & dTo & "]")
        Dim PrestaSharpOrderIds As List(Of Long) = o.GetIdsByFilter(filter, "id_DESC", Nothing)

Stack trace: at System.Linq.Enumerable.Where[TSource](IEnumerable1 source, Func2 predicate) at Bukimedia.PrestaSharp.Factories.GenericFactory1.GetIdsByFilter(Dictionary2 Filter, String Sort, String Limit) at Gestiune.PrestaShop.verificaComenzi(String user, String parola, Int32 IdMagazin, DateTime dataInceput, DateTime dataSfarsit)

danicodeRO commented 4 years ago

I have downloaded the source code, and the error is here:

image

at Bukimedia.PrestaSharp.Deserializers.PrestaSharpDeserializer.CreateAndMap(Type t, XElement element) in E:\temp\PrestaSharp-master\PrestaSharp\Deserializers\PrestaSharpDeserializer.cs:line 378 at Bukimedia.PrestaSharp.Deserializers.PrestaSharpDeserializer.PopulateListFromElements(Type t, IEnumerable`1 elements, IList list) in E:\temp\PrestaSharp-master\PrestaSharp\Deserializers\PrestaSharpDeserializer.cs:line 282

danicodeRO commented 4 years ago

I have installed PrestaSharp.Extended and it fixed the errors. Hope it helps others..