applejag/Newtonsoft.Json-for-Unity

Can't debug objects in LINQ name space

MAYP-dotswan opened this issue · 7 comments

This is not directly a problem with this repository but as you mentioned that unity is forking your repo and now using it as internal inside unity. I get problem with it only when I try to debug the project.
each time I place a breakpoint and try to evaluate for example Jtoken.Value<>() or JObject.SelectToken I get Exception of type 'System.Security.VerificationException' was thrown: Method with token 100665429 not found in type Newtonsoft.Json.Linq.Extensions exception and the value is not shown to me. but everything is working fine in project and after I step forward from the breakpoint I can see the value is assign to variable and it's correct.
I send a bug report to unity, ask it from stack overflow and also in unity forum but no one know what's the problem.

Hello @MAYP-dotswan! Sorry to hear that you are unable to resolve this. I've sadly never heard about this error before, but I can make an attemt in helping you debug it.

For me to debug this, I will have to try reproduce this. Could you please supply the following values:

  • Unity version?
  • Platform? Ex inside Android builds, Windows builds, or just inside the Unity Editor?
  • Newtonsoft.Json UPM package version?
  • Code sample of types you're trying to access?
  • Code sample of JSON you're trying to serialize/deserialize/work with?

Better with too much into than too little.

Hello thank you for response,
It's only happening in editor I try 2022.2.0f1 and 2022.2.3f1.
Testing on both 2.0.0 and 2.0.2 UPM package versions.

It works fine when I build the project in any platform. also, in editor it will work fine normally only I can't fetch their data in debug mode.

JsonSample.txt
.
CodeSample.txt

Hello again, sorry but did you able to reproduce the issue?!
I still have the issue and even after updating the Unity the problem is still existed.

No sorry I haven't found the time. I'll allocate some time for it this week. So sorry!

No problem just checking in if you find a time.
Thanks in advance

Hi again. Some questions:

  1. The two files you uploaded seem to have the same content. Could you provide a JSON sample? I was able to produce a sample JSON file from your code sample (jilleJr's JsonSample.txt), but having the exact same file as you makes it dismiss that as a possible cause.

  2. I'm assuming the SO post you're referring to is this one https://stackoverflow.com/questions/70006389/adding-watcher-or-evaluate-object-in-rider-unity-will-cause-to-throw-exception-i ? If so, then you state in the comments that this only happens with Rider and not VS, correct?

  3. The Unity version you're referring to doesn't exist yet. Do you perhaps mean 2021.2.0f1 instead of 2022.2.0f1? Or perhaps some 2022 beta version?

From some testing, I was unable to reproduce this with Unity 2021.2.7f1 in both VS 17.0.2 and Rider 2021.3.2.

No exceptions appeared when I was stepping through the code, and I could even step into the functions without any issues.

image

Please confirm the version of Rider or VS that you're using, as well as clarify the Unity version. Does this also happen for you on later versions of Unity or only some?


One thing I noticed is that my package contains the .pdb files (e.g for v13.0.102) while Unity's package v2.0.2 does not and instead only contains the .dll files, as can be seen in a project's package cache:

image

This is just a theory, but this could be the source of the issue. My guess is that your Rider installation doesn't have the decompilation enabled, or something like that, and when it tries to debug the Newtonsoft.Json code it fails due to the missing .pdb file and then throws an exception inside Rider. Again: this is mere speculations.

As I'm unable to reproduce, I'm unable to research further.

Excuse me for invoking stress but I just instated a 30 days trial of Rider, so if this is connected to Rider and Rider only then we only have 30 days left to debug this issue.

Hello, so sorry for wrong information specially the JSON sample.
for editor version your right I use 2021.2.0f1 and 2021.2.3f1 and also 2021.2.6 and the problem is happening in all of them.
about the IDE you mentioned I will get the error in both of them and the result is almost the same but only the error is different in VS 2019 and 2022.
I will make exact sample of the JSON files and send it again.
I didn't check the .pdb file I will and let you know the result.
Thanks for giving your time to help the issue.
I will let you know the result and send the missing files