We have tried this code that works in the class but fails in the Immediate Window:
System.IO.StreamWriter file = System.IO.File.CreateText("z:\\file.json");
Newtonsoft.Json.JsonSerializer serializer = new Newtonsoft.Json.JsonSerializer();
serializer.Serialize(file, myCollection);
file.Close();
Even if the Immediate Window returns "Expression has been evaluated and has no value" after each command, the file only has a part of the Json: the file ends abruptly in the middle of a word. Any idea on how to solve this?
As @dbc pointed out in a comment, the problem was a premature file inspection before properly calling
file.Close();
Thanks!