cake-contrib/Cake.Json

ParseJsonFromFile errors in v2.0.28

WalkerCodeRanger opened this issue ยท 4 comments

If I create a new Cake 0.22.2 project by running the bootstrapper (Invoke-WebRequest https://cakebuild.net/download/bootstrapper/windows -OutFile build.ps1), then add Cake.Json and Newtonsoft.Json and make a call to ParseJsonFromFile, I get Error: One or more errors occurred. when running the build.

I have attached my build.cake and the json file buildMetadata.json. Note that I had to add a .txt extension to upload them to github, that will have to be removed to reproduce the issue.

I'm also getting the same error, you can get more detailed output with:

./build.ps1 -verbosity=diagnostic

To workaround, I'm using Cake.FileHelpers and Newtonsoft.Json directly:

#addin "Cake.FileHelpers"
#addin nuget:?package=Newtonsoft.Json&version=9.0.1

var text = FileReadText("./file.json");
var json = Newtonsoft.Json.Linq.JObject.Parse(text);

I've worked around it by going down to the previous version which required a higher version of Newtonsoft.Json.

#addin nuget:?package=Newtonsoft.Json&version=10.0.3
#addin nuget:?package=Cake.Json&version=2.0.0.27

It seems that downgrading the version for just the Newtonsoft.Json package is enough. Cake.Json does not need to change.

gep13 commented

@WalkerCodeRanger @iapazmino I am going to go ahead and close this, as it sounds like we got the problem worked out. Let me know if there is still an issue that needs to be looked at.