JsonException Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
JsonException() |
Initializes a new instance of the JsonException class. |
JsonException(String) |
Initializes a new instance of the JsonException class with a specified error message. |
JsonException(SerializationInfo, StreamingContext) |
Obsolete.
Creates a new exception object with serialized data. |
JsonException(String, Exception) |
Initializes a new instance of the JsonException class, with a specified error message and a reference to the inner exception that is the cause of this exception. |
JsonException(String, String, Nullable<Int64>, Nullable<Int64>) |
Creates a new exception object to relay error information to the user. |
JsonException(String, String, Nullable<Int64>, Nullable<Int64>, Exception) |
Creates a new exception object to relay error information to the user that includes a specified inner exception. |
JsonException()
- Source:
- JsonException.cs
- Source:
- JsonException.cs
- Source:
- JsonException.cs
Initializes a new instance of the JsonException class.
public:
JsonException();
public JsonException ();
Public Sub New ()
Applies to
JsonException(String)
- Source:
- JsonException.cs
- Source:
- JsonException.cs
- Source:
- JsonException.cs
Initializes a new instance of the JsonException class with a specified error message.
public:
JsonException(System::String ^ message);
public JsonException (string? message);
public JsonException (string message);
new System.Text.Json.JsonException : string -> System.Text.Json.JsonException
Public Sub New (message As String)
Parameters
- message
- String
The context-specific error message.
Applies to
JsonException(SerializationInfo, StreamingContext)
- Source:
- JsonException.cs
- Source:
- JsonException.cs
- Source:
- JsonException.cs
Caution
This API supports obsolete formatter-based serialization. It should not be called or extended by application code.
Creates a new exception object with serialized data.
protected:
JsonException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected JsonException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected JsonException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Text.Json.JsonException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Text.Json.JsonException
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Text.Json.JsonException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Text.Json.JsonException
Protected Sub New (info As SerializationInfo, context As StreamingContext)
Parameters
- info
- SerializationInfo
The serialized object data about the exception being thrown.
- context
- StreamingContext
An object that contains contextual information about the source or destination.
- Attributes
Exceptions
info
is null
.
Applies to
JsonException(String, Exception)
- Source:
- JsonException.cs
- Source:
- JsonException.cs
- Source:
- JsonException.cs
Initializes a new instance of the JsonException class, with a specified error message and a reference to the inner exception that is the cause of this exception.
public:
JsonException(System::String ^ message, Exception ^ innerException);
public JsonException (string? message, Exception? innerException);
public JsonException (string message, Exception innerException);
new System.Text.Json.JsonException : string * Exception -> System.Text.Json.JsonException
Public Sub New (message As String, innerException As Exception)
Parameters
- message
- String
The context-specific error message.
- innerException
- Exception
The exception that caused the current exception.
Applies to
JsonException(String, String, Nullable<Int64>, Nullable<Int64>)
- Source:
- JsonException.cs
- Source:
- JsonException.cs
- Source:
- JsonException.cs
Creates a new exception object to relay error information to the user.
public:
JsonException(System::String ^ message, System::String ^ path, Nullable<long> lineNumber, Nullable<long> bytePositionInLine);
public JsonException (string? message, string? path, long? lineNumber, long? bytePositionInLine);
public JsonException (string message, string path, long? lineNumber, long? bytePositionInLine);
new System.Text.Json.JsonException : string * string * Nullable<int64> * Nullable<int64> -> System.Text.Json.JsonException
Public Sub New (message As String, path As String, lineNumber As Nullable(Of Long), bytePositionInLine As Nullable(Of Long))
Parameters
- message
- String
The context-specific error message.
- path
- String
The path where the invalid JSON was encountered.
The line number (starting at 0) at which the invalid JSON was encountered when deserializing.
The byte count within the current line (starting at 0) where the invalid JSON was encountered.
Remarks
Note that bytePositionInLine
counts the number of bytes (that is, UTF-8 code units), and not characters or scalars.
Applies to
JsonException(String, String, Nullable<Int64>, Nullable<Int64>, Exception)
- Source:
- JsonException.cs
- Source:
- JsonException.cs
- Source:
- JsonException.cs
Creates a new exception object to relay error information to the user that includes a specified inner exception.
public:
JsonException(System::String ^ message, System::String ^ path, Nullable<long> lineNumber, Nullable<long> bytePositionInLine, Exception ^ innerException);
public JsonException (string? message, string? path, long? lineNumber, long? bytePositionInLine, Exception? innerException);
public JsonException (string message, string path, long? lineNumber, long? bytePositionInLine, Exception innerException);
new System.Text.Json.JsonException : string * string * Nullable<int64> * Nullable<int64> * Exception -> System.Text.Json.JsonException
Public Sub New (message As String, path As String, lineNumber As Nullable(Of Long), bytePositionInLine As Nullable(Of Long), innerException As Exception)
Parameters
- message
- String
The context-specific error message.
- path
- String
The path where the invalid JSON was encountered.
The line number (starting at 0) at which the invalid JSON was encountered when deserializing.
The byte count (starting at 0) within the current line where the invalid JSON was encountered.
- innerException
- Exception
The exception that caused the current exception.
Remarks
Note that the bytePositionInLine
counts the number of bytes (that is, UTF-8 code units), and not characters or scalars.