You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 24, 2022. It is now read-only.
I get an uncaught exception of type System.InvalidCastException when I try to execute the following:
// Load the document
using (Stream strm = archive.GetFileStream("package.json"))
{
using (StreamReader reader = new StreamReader(strm))
{
// The following line crashes!
dynamic rootObject = JsonConvert.DeserializeObject(reader.ReadToEnd());
}
}
The generated JSIL line that causes the crash somewhere in the NewtonSoft.Json.dll js code looks like this:
var rootObject = $T0D().DeserializeObject(($S05().Construct(strm)).ReadToEnd());
Exception message in log div:
Unhandled exception at http://127.0.0.1/web/Libraries/JSIL.Core.js line 5034:
Uncaught System.InvalidCastException: Unable to cast object of type 'Newtonsoft.Json.JsonTextReader' to type 'Newtonsoft.Json.Serialization.TraceJsonReader'.
Edit: The C# code runs just fine in a compiled Windows application, so the JSON data isn't corrupted. Edit 2: I also checked in the javascript debugger that the stream contains the correct json text value, so everything got loaded correctly from the local file storage.