语言

JsonException 构造函数

定义

重载

名称 说明
JsonException()

初始化 JsonException 类的新实例。

JsonException(String)

使用指定的错误消息初始化类的新实例 JsonException 。

JsonException(SerializationInfo, StreamingContext)
已过时.

创建包含序列化数据的新异常对象。

JsonException(String, Exception)

使用指定的错误消息和对作为此异常原因的内部异常的引用初始化类的新实例 JsonException 。

JsonException(String, String, Nullable<Int64>, Nullable<Int64>)

创建一个新的异常对象,以将错误信息中继给用户。

JsonException(String, String, Nullable<Int64>, Nullable<Int64>, Exception)

创建一个新的异常对象,以将错误信息中继到包含指定内部异常的用户。

JsonException()

Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs

初始化 JsonException 类的新实例。

public:
 JsonException();
public JsonException();
Public Sub New ()

适用于

JsonException(String)

Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs

使用指定的错误消息初始化类的新实例 JsonException 。

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)

参数

message
String

特定于上下文的错误消息。

适用于

JsonException(SerializationInfo, StreamingContext)

Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs

注意

This API supports obsolete formatter-based serialization. It should not be called or extended by application code.

创建包含序列化数据的新异常对象。

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);
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}")>]
new System.Text.Json.JsonException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Text.Json.JsonException
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)

参数

info
SerializationInfo

有关引发异常的序列化对象数据。

context
StreamingContext

包含有关源或目标的上下文信息的对象。

属性

例外

info 是 null。

适用于

JsonException(String, Exception)

Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs

使用指定的错误消息和对作为此异常原因的内部异常的引用初始化类的新实例 JsonException 。

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)

参数

message
String

特定于上下文的错误消息。

innerException
Exception

导致当前异常的异常。

适用于

JsonException(String, String, Nullable<Int64>, Nullable<Int64>)

Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs

创建一个新的异常对象,以将错误信息中继给用户。

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))

参数

message
String

特定于上下文的错误消息。

path
String

遇到无效 JSON 的路径。

lineNumber
Nullable<Int64>

反序列化时遇到无效 JSON 的行号(从 0 开始)。

bytePositionInLine
Nullable<Int64>

当前行(从 0 开始)中的字节计数,其中遇到无效 JSON。

注解

请注意, bytePositionInLine 计算字节数(即 UTF-8 代码单元),而不是字符或标量。

适用于

JsonException(String, String, Nullable<Int64>, Nullable<Int64>, Exception)

Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs
Source:
JsonException.cs

创建一个新的异常对象,以将错误信息中继到包含指定内部异常的用户。

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)

参数

message
String

特定于上下文的错误消息。

path
String

遇到无效 JSON 的路径。

lineNumber
Nullable<Int64>

反序列化时遇到无效 JSON 的行号(从 0 开始)。

bytePositionInLine
Nullable<Int64>

遇到无效 JSON 的当前行中的字节计数(从 0 开始)。

innerException
Exception

导致当前异常的异常。

注解

请注意,计算 bytePositionInLine 字节数(即 UTF-8 代码单元),而不是字符或标量。

适用于