Some strange behavior with x86 OS.

Dec 12, 2009 at 11:05 PM
Edited Dec 12, 2009 at 11:09 PM

Hello. I'm developing .NET C# application and i'm using JSON.NET library to deserialize json-data received from the remote web-server.

All works just great on the developer machine, but when i tried to place my application to the target x86 machine with installed Windows XP 64 i've encountered some strange behavior.

 

  // classes

  class JsonServList
  {
    public int error;
    public int count;
    public List<JsonServListServer> servers;
    
  };
  
  class JsonServListServer
  {
    public int    id;
    public string ip;
    public int    port;
    
  };

  // code

  JsonServList servList = null;
      
  try
  {
    servList = JsonConvert.DeserializeObject<JsonServList>(string_with_json_data);
      
  }
  catch(Exception ex)
  {
    this.objLogger.addRecord("failed to deserialize data from the " +
                             "JSON representation: " + ex.Message);
        
  }

 

I've got the following error in my log-file:

[13.12.2009 01:16:44] failed to deserialize data from the JSON representation: The type initializer for 'Newtonsoft.Json.Serialization.JsonTypeReflector' threw an exception.;

When i tried to use 2.0 version of this library there was an Int64 -> Int32 conversion exception. Currently i'm using latest 3.5 version.

Please advise...

Coordinator
Dec 13, 2009 at 3:33 AM

I need some more information like the stacktrace and the inner exception details before I can say what is wrong or fix it.