System.Text.JSON 6.0.2 version and above throw error with JsonSerializer.Deserialize

804 Views Asked by At

I have created a basic template Class library (see image below) and added just one reference system.text.json (version 6.0.2) through manage nuggets

enter image description here

enter image description here

Created a Console application with the above Class library as reference. (basic template just added reference to the class library)

enter image description here

Is throws error starting version 6.0.2 and tested 6.0.3 and 6.0.4 as well same issue whenever this code is existing JsonSerializer.Deserialize

Am I missing prerequisite reference to make this work ? Have tried the binding redirect with no success either. Please Advise

Below are the version of the framework used

enter image description here

1

There are 1 best solutions below

0
On

You need to upgrade "system.text.json" version in console application. Root cause : In class library some of the reference have dependency with "system.text.json" versions that you have in class library project but not console application.