cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brodybits <...@git.apache.org>
Subject [GitHub] cordova-wp8 pull request: Added Newtonsoft json dll
Date Thu, 07 May 2015 12:32:12 GMT
Github user brodybits commented on the pull request:

    https://github.com/apache/cordova-wp8/pull/79#issuecomment-99847116
  
    > @brodybits follow these steps:
    
    as documented in https://github.com/apache/cordova-plugin-test-framework. Could add a
reference to README.md in the plugin for those who may be unfamiliar. Thanks @vladimir-kotikov.
    
    > It looks like these changes brought new test failures on wp8:
    > https://issues.apache.org/jira/browse/CB-8968
    
    If we would restore the old code in `JsonHelper.Serialize` in `template/cordovalib/JSON/JsonHelper.cs`
then the problem in CB-8968 goes away. Then:
    
    Using `JsonConvert.SerializeObject` from `Newtonsoft.Json` in cordova-plugin-file *is
working OK in the test*:
    
    ```diff
    --- a/src/wp/File.cs
    +++ b/src/wp/File.cs
    @@ -22,7 +22,9 @@
     using System.Text;
     using System.Windows;
     using System.Windows.Resources;
    +
     using WPCordovaClassLib.Cordova.JSON;
    +using Newtonsoft.Json;
     
     namespace WPCordovaClassLib.Cordova.Commands
     {
    @@ -771,7 +773,7 @@ public void readAsText(string options)
                     // JIRA: https://issues.apache.org/jira/browse/CB-8792
                     // Need to perform additional serialization here because NativeExecution
is always trying
                     // to do JSON.parse() on command result. This leads to issue when trying
to read JSON files
    -                var resultText = JsonHelper.Serialize(text);
    +                var resultText = JsonConvert.SerializeObject(text);
                     DispatchCommandResult(new PluginResult(PluginResult.Status.OK, resultText),
callbackId);
                 }
                 catch (Exception ex)
    ```
    
    Using `JsonConvert.SerializeObject` from `Newtonsoft.Json` in `template/cordovalib/ScriptCallback.cs`
is *working OK in the cordova-plugin-file test*:
    
    ```diff
    --- a/template/cordovalib/ScriptCallback.cs
    +++ b/template/cordovalib/ScriptCallback.cs
    @@ -25,6 +25,8 @@
     using WPCordovaClassLib.Cordova.JSON;
     using System.Diagnostics;
     
    +using Newtonsoft.Json;
    +
     namespace WPCordovaClassLib.Cordova
     {
         /// <summary>
    @@ -65,7 +67,7 @@ public ScriptCallback(string function, string id, object msg, object
value)
                 this.ScriptName = function;
     
                 String arg = String.Format("{{\"id\": {0}, \"msg\": {1}, \"value\": {2}}}",
    -                 JsonHelper.Serialize(id), JsonHelper.Serialize(msg), JsonHelper.Serialize(value));
    +                 JsonConvert.SerializeObject(id), JsonConvert.SerializeObject(msg), JsonConvert.SerializeObject(value));
     
                 this.Args = new string[] { arg };
             }
    ```
    
    Using `JsonConvert.SerializeObject` from `Newtonsoft.Json` in `template/cordovalib/CordovaCommandCall.cs`
gave me a problem with `file.spec.83` (blob test) the first time, then was passing the cordova-plugin-file
tests when I tried it again (should be OK).
    
    Using `JsonConvert.SerializeObject` from `Newtonsoft.Json` in `template/cordovalib/PluginResult.cs`
gives me the errors as described in CB-8968.
    
    Wondering if any other Apache Cordova or major third-party plugins would be affected as
well.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Mime
View raw message