Click here to Skip to main content
15,888,095 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an assembly dynamically loaded through MEF. Inside the assembly I have dynamic objects reconstructed from JSON by Newtonsoft.Jnon like follows.
C#
JObject jObject = (JObject)JsonConvert.DeserializeObject(data);
long id = jObject.id;

This code compiles and runs fine on several machines with a given test string as an argument. However, on one machine, for some reason, it fails with the following exception:
Quote:
Anonymously Hosted DynamicMethods Assembly System.Object CallSite.Target(System.Runtime.CompilerServices.Closure, System.Runtime.CompilerServices.CallSite, System.Object) 'Newtonsoft.Json.Linq.JObject' does not contain a definition for 'id' at CallSite.Target(Closure , CallSite , Object )

Importantly, on all machines I run one and the same compiled set of binaries with equal input data. Machines also have equal OS Win 10 x64. Why the error appears on one machine and does not appear on others? Thank you.

What I have tried:

I ve tried to eliminate this call to "id" and access other members of jObject. The error remains the same. It looks that the whole dynamic loading of JSON objects is broken. Newtonsoft.Jnon assembly is copied along with other assemblies in this package and resides on all test machines in the same folder as executing exe and MEF assemblies.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900