[ https://issues.apache.org/jira/browse/CB-8968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14532541#comment-14532541 ]
ASF GitHub Bot commented on CB-8968: ------------------------------------ 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. > File failures on WP8 > -------------------- > > Key: CB-8968 > URL: https://issues.apache.org/jira/browse/CB-8968 > Project: Apache Cordova > Issue Type: Bug > Components: Plugin File, WP8 > Reporter: Alexander Sorokin > Assignee: Jesse MacFadyen > > New failures showed up in mobilespec for wp8: > {code} > cordova-plugin-file-tests.tests >> File API Read method file.spec.87 should > read file properly, readAsArrayBuffer > cordova-plugin-file-tests.tests >> File API Read method file.spec.94 should > read sliced file properly, readAsArrayBuffer > cordova-plugin-file-tests.tests >> File API FileWriter file.spec.106 should > be able to write a File to a FileWriter > cordova-plugin-file-tests.tests >> File API FileWriter file.spec.107 should > be able to write a sliced File to a FileWriter > cordova-plugin-file-tests.tests >> File API FileWriter file.spec.108 should > be able to write binary data from a File > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org