luantn2 / google-api-dotnet-client

Automatically exported from code.google.com/p/google-api-dotnet-client
Apache License 2.0
0 stars 0 forks source link

Web master tools - Sitemap list and crawler error query throwing Json Parsing Error. #510

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  Install-Package Google.Apis.Webmasters.v3 
2.  service.Sitemaps.List(site).Execute();  
or 
    service.Urlcrawlerrorscounts.Query(site).Execute();

What is the expected output? 
 response body 

What do you see instead?
{The service webmasters has thrown an exception: Google.GoogleApiException: An 
Error occurred, but the error response could not be deserialized ---> 
Newtonsoft.Json.JsonReaderException: Error parsing NaN value. Path '', line 0, 
position 0.
   at Newtonsoft.Json.JsonTextReader.ParseNumberNaN()
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonTextReader.ReadInternal()
   at Newtonsoft.Json.JsonTextReader.Read()
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
   at Google.Apis.Json.NewtonsoftJsonSerializer.Deserialize[T](String input) in c:\code\google.com\google-api-dotnet-client\default\Tools\Google.Apis.Release\bin\Debug\test\default\Src\GoogleApis.Core\Apis\Json\NewtonsoftJsonSerializer.cs:line 120
   at Google.Apis.Services.BaseClientService.<DeserializeError>d__8.MoveNext() in c:\code\google.com\google-api-dotnet-client\default\Tools\Google.Apis.Release\bin\Debug\test\default\Src\GoogleApis\Apis\Services\BaseClientService.cs:line 286
   --- End of inner exception stack trace ---
   at Google.Apis.Requests.ClientServiceRequest`1.Execute() in c:\code\google.com\google-api-dotnet-client\default\Tools\Google.Apis.Release\bin\Debug\test\default\Src\GoogleApis\Apis\Requests\ClientServiceRequest.cs:line 96
   at Google_WebmasterTools_dotnet.DaimtoWebMasterSiteMapsHelper.list(WebmastersService service, String site) in K:\Development\hold\Google-WebmasterTools-dotnet\Google-WebmasterTools-dotnet\DaimtoWebMasterSiteMapsHelper.cs:line 24}

What version of the product are you using?
https://www.nuget.org/packages/Google.Apis.Webmasters.v3/

What is your operating system?
windows 7

What is your IDE?
Visual studio 10

What is the .NET framework version?
dot net 4.0

Please provide any additional information below.

sites list appears to work fine. 

Original issue reported on code.google.com by laurl...@gmail.com on 24 Nov 2014 at 1:14

GoogleCodeExporter commented 9 years ago
Can you please attach your code as well?
Thanks

Original comment by pele...@google.com on 25 Nov 2014 at 9:45

GoogleCodeExporter commented 9 years ago
Here you go :) you can also find it on GitHub.  
https://github.com/LindaLawton/Google-Dotnet-Samples/tree/master/Google-WebMaste
rTools

The code is very simple just that

 public static UrlCrawlErrorsCountsQueryResponse query(WebmastersService service, string site)
        {

            try
            {
               var x =  service.Urlcrawlerrorscounts.Query(site).Execute();

               return x;
            }
            catch (Exception ex)
            {

                Console.WriteLine(ex.InnerException);
                return null;
            }

        }       

Original comment by laurl...@gmail.com on 25 Nov 2014 at 9:57

GoogleCodeExporter commented 9 years ago
And another thing... can you attach the HTTP request and response as well?

Sorry... thanks :)

Original comment by pele...@google.com on 10 Dec 2014 at 4:11

GoogleCodeExporter commented 9 years ago
Sure if you can tell me how.  I didn't know we had any control over the HTTP 
request that the client lib sends.   

pele...@google.com who ever you are i have tried to track you down for a year. 
Please contact me i would love to chat with you about this and a few other bugs 
i have found :)

Original comment by laurl...@gmail.com on 12 Dec 2014 at 9:11