語言

JsonException 建構函式

定義

多載

名稱 Description
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()

來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs

初始化 JsonException 類別的新執行個體。

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

適用於

JsonException(String)

來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
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)

來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
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)

來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
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>)

來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
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>

目前在遇到無效 JSON 的行(從 0 開始)內的位元組數。

備註

請注意,該 bytePositionInLine 數字是位元組數(即 UTF-8 碼單位),而非字元或純量。

適用於

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

來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs
來源:
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 編碼單位),而非字元或純量。

適用於