kevbite / CompaniesHouse.NET

A simple .NET client wrapper for CompaniesHouse API
MIT License
37 stars 44 forks source link

Issue using CompanySearch for search string "Bay Horse" #97

Closed JulianGuppy closed 5 years ago

JulianGuppy commented 5 years ago

I have just started using the SearchCompanyAsync with the SearchRequest set to Query = "Bay Horse", StartIndex = 0, ItemsPerPage = 100

Snippet

           var request = new SearchRequest
            {
                Query = search,
                StartIndex = 0,
                ItemsPerPage = 100
            };
            var task = Task.Run<global::CompaniesHouse.CompaniesHouseClientResponse<global::CompaniesHouse.Response.Search.CompanySearch.CompanySearch>>(async () => await _companiesHouseClient.SearchCompanyAsync(request));
            var companiesHouseClientResponse = task.Result;
            var companies = companiesHouseClientResponse.Data;
            if (companies == null)
            {
                result.Code = ErrorCodes.CompanyNotFound;
                result.Message = "We could not find a company with that search term " + search;
                return result;
            }

When I make this call I get the following error message, :-

Error converting value "" to type 'CompaniesHouse.Response.CompanyType'. Path 'company_type', line 1, position 27814.

So I am assuming that the data that comes back from companies house is upsetting the Deserialisation code as its an empty or null company type.

Is there any chance you can look at why this is...

Regards Julian

kevbite commented 5 years ago

@JulianGuppy this is now fixed in version 6.1.4. If you have any other problems please feel free to raise them. Thanks