Bellow is modified Load method:
{
Set data=##class(User.Data).%OpenId(Ident)
Quit:data="" "null" // Original
Set model=##class(User.Model).%New()
Set model.Ident=data.Ident
Do model.PNG.CopyFrom(data.PNG)
Do model.%JSONExportToString(.json) Set file=##class(%File).%New("C:\Tmp\1.txt") //Log the json string
Do file.Open("WSN")
Do file.Write(json)
Do file.Close() // Workaround
Set model=##class(User.Model).%New()
Set model.Ident=data.Ident
Do model.%JSONExportToString(.json) // CHANGE in workaround
Set a={}.%FromJSON(json)
Do a.%Set("PNG",data.PNG,"stream>base64")
// Set file=##class(%File).%New("C:\Tmp\2.txt") //Log the json string
Do file.Open("WSN")
Do file.Write(a.%ToJSON())
Do file.Close() Quit json
}
Compare files 1.txt and 2.txt, they are different, but they should be equal. With string recorded in 2.txt c# app doesn't throw the exception.
- Log in to post comments