title: System.Text.Json.JsonReaderException isn't found in namespace
body: <p>I'm converting a .NET Framework 4.5 project to .NET Core 3.1. My tests used to use Newtonsoft.Json to check if json is valid and now I would want to implement the same with the built-in System.Text.Json. It appears that</p>
  
  <pre><code>JsonElement values = JsonDocument.Parse(json).RootElement;
  </code></pre>
  
  <p>throws <code>System.Text.Json.JsonReaderException</code>, but I'm unable to catch this as pointing to this exception results in error </p>
  
  <blockquote>
    <p>The type or namespace name 'JsonReaderException' does not exist in the namespace 'System.Text.Json' (are you missing an assembly reference?)</p>
  </blockquote>
  
  <p>I would just want to understand how is it possible that something that doesn't actually seem to exist can be thrown.</p>
  
  <p>Update #1:
  Stacktrace:</p>
  
  <pre><code>   at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader&amp; json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
     at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
     at System.Text.Json.Utf8JsonReader.Read()
     at System.Text.Json.JsonDocument.Parse(ReadOnlySpan`1 utf8JsonSpan, Utf8JsonReader reader, MetadataDb&amp; database, StackRowStack&amp; stack)
     at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 utf8Json, JsonReaderOptions readerOptions, Byte[] extraRentedBytes)
     at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 json, JsonDocumentOptions options)
     at System.Text.Json.JsonDocument.Parse(String json, JsonDocumentOptions options)
     at Anonymized..ctor(String json) in Anonymized.cs:line 182
     at Anonymized.&lt;&gt;c__DisplayClass12_0.&lt;TestCreateLogEntryFromJson_IllegalValues&gt;b__0() in Anonymized.cs:line 206
     at NUnit.Framework.Assert.Throws(IResolveConstraint expression, TestDelegate code, String message, Object[] args)
  </code></pre>
  
  <p>Update #2:
  I went to see if there would be some nugets that I'm missing. I found System.Text.Json as a nuget (although it was already accessible, I used System.Text.JsonSerializer successfully within the test file). I added it and now I get the actual problem: It is inaccessible due to its protection level.</p>
  
  <pre><code>using System.Text.Json;
  
  namespace System.Text.Json
  {
      internal sealed class JsonReaderException : JsonException
      {
          public JsonReaderException(string message, long lineNumber, long bytePositionInLine);
      }
  }
  </code></pre>
  
  <p>This doesn't however directly solve, how I can catch this within <strong><code>Assert.Throws&lt;System.Text.Json.JsonReaderException&gt;</code></strong>?</p>