Last week encountered a very strange pit, first wrote two programs, the first program output into a DLL, the second program is a console program.
In the first program, I used the process to start a second program and passed in a JSON as a parameter, namely:
Process.Start (Program2.exe, Jsonpara);
This Jsonpara converts a list<list<string>> generic to a string type.
As a result, when I was excited to wait for the moment of the program, the console error, Newtonsoft.Json.reader Balabala errors ...
Troubleshooting process:
1) Program Two control console parameters debugging, error-free ...
2) Program One check JSON is not correct, error-free ...
3) Program two console output incoming parameters, Error!!!
cause : JSON escapes the quotation marks ... Of course, your debugging in the program one is displayed correctly, but it changes when the console receives it!!!
Solution: For the stability of the program, the direct JSON is written to a TXT file, and then the console program to read the file.
Note: If you go to the console to modify the escaped parameters and then read correctly, or in the program one to modify the JSON parameters, so that it escaped to become the correct parameters, the personal feel the outweigh the gains, has not been written to read the file convenient.
C # Basics-a pit that uses JSON to pass values to the console program