-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read JObject Property: System.Security.VerificationException: Operation could destabilize the runtime #95445
Comments
If it is not run through the windows service, I control the processing through conditional compilation in Debug mode, which is equivalent to a normal console program. public static void Main()
{
#if DEBUG
Collect(false);
#elif RELEASE
ServiceBase.Run(new CollectorService());
#endif
} |
Which version of runtime are you using? Is it .NET Framework or .NET Core/5+? I remember that .NET Core has disabled IL verification. |
.NET Framework 4.7.2 |
.NET Framework specific problem should be reported to Developer Community. Sounds like a runtime issue since it differs for Release configuration, but I'd suggest you to send compiled binaries there.
|
Sorry, I didn't get a good look |
I remember that this warehouse should be able to handle .net framework issues last year. Do I need to move it there? I will mark it now and resubmit it later. Of course, I will submit it to newtonsoft.json by the way. My current plan is to use the system's native Json class to handle the Json string parsing problem. This is a data parsing problem caused by RestReponse.Conten(RestSharp). |
Even trying to use the Json class that comes with the system is still futile and has not improved. But then again, the NewtonSoft.Json deserialization reponse.Content(json string) will not report an error, and the Json deserialization that comes with the object system will always fail to throw an exception. When reading attributes, neither method can handle them. |
It is correct to implement this direction based on regular expression, which has been verified and can avoid the problem based on reading json attributes. There is also a idea is the algorithm to implement, the core algorithm is the bracket matching algorithm, defining the Node entity class storage data structure, this idea is feasible, the intermediate algorithm can use regular to lazy (XD). public static Dictionary<string, string> Match(string json)
{
var matches = Regex.Matches(json, Resources.JsonPattern);
var results = new Dictionary<string, string>();
foreach (Match match in matches)
{
var key = match.Groups[1].Value;
var value = match.Groups[2].Value;
results.Add(key, value);
}
return results;
} |
Clarification: It turns out I made a stupid mistake, but this kind of mistake happens very easily and can lead to huge misunderstandings. // correct type // error type But when it allows me to get the returned results, the text content displayed is unicode encoding. I originally read that the Chinese in repoense.Content is normally visible. So the system serializer doesn't seem to be very friendly. Maybe it's my problem, but it's really not easy to use. |
Clarification: It turns out I made a stupid mistake, but this kind of mistake happens very easily and can lead to huge misunderstandings. After all, the Json class that comes with the system basically runs well (the previous error was caused by me using the wrong type, and it was easy for me to confuse the types), but Newtonsoft made an error (it will only be exposed when running in a windows service). // correct type // error type But when it allows me to get the returned results, the text content displayed is unicode encoding. I originally read that the Chinese in repoense.Content is normally visible. So the system serializer doesn't seem to be very friendly. Maybe it's my problem, but it's really not easy to use. |
Therefore, the final problem is most likely to be Newtonsoft.Json's own factors, although it is also possible that the underlying layer is not robust enough. In addition, I encountered many prompts when reading properties in Newtonsoft.Json. Previously, there was a warning about unstable JToken parsing. Now, more problems with JObject reading properties are exposed. So, I hope Newtonsoft.Json can handle it smoothly. |
I am very sorry, this is my problem, I did not fully realize that a change factor is the obfuscation code. There is no problem after testing simple demo confusion and cannot prove anything. When the modification of the slightly more complicated obfuscator causes hidden dangers to the code, involving problems such as IL code, it causes the program to run malfunctions. I have now basically concluded through the control group experiment that it has something to do with the obfuscator, and this problem need not be paid too much attention. Regarding json deserialization to obtain Chinese characters, if no one answers, I will initiate an issue separately. This issue can be closed, of course, there is no good way to decode the problem now. |
Description
JObject access seems to be prone to instability in windows service, causing runtime errors, at least when accessing its attributes. This problem is fatal. At present, if your team cannot give an effective solution in time, I may have to consider how to bypass this problem, but NewtonSoft.Json serialization is no problem.
Reproduction Steps
Example code:
Log:
Expected behavior
No response
Actual behavior
No response
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: