Diagnostic.Create 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
Create(DiagnosticDescriptor, Location, Object[])
建立 Diagnostic 執行個體。
public:
static Microsoft::CodeAnalysis::Diagnostic ^ Create(Microsoft::CodeAnalysis::DiagnosticDescriptor ^ descriptor, Microsoft::CodeAnalysis::Location ^ location, ... cli::array <System::Object ^> ^ messageArgs);
public static Microsoft.CodeAnalysis.Diagnostic Create (Microsoft.CodeAnalysis.DiagnosticDescriptor descriptor, Microsoft.CodeAnalysis.Location location, params object[] messageArgs);
public static Microsoft.CodeAnalysis.Diagnostic Create (Microsoft.CodeAnalysis.DiagnosticDescriptor descriptor, Microsoft.CodeAnalysis.Location? location, params object?[]? messageArgs);
public static Microsoft.CodeAnalysis.Diagnostic Create (Microsoft.CodeAnalysis.DiagnosticDescriptor descriptor, Microsoft.CodeAnalysis.Location location, params object?[] messageArgs);
static member Create : Microsoft.CodeAnalysis.DiagnosticDescriptor * Microsoft.CodeAnalysis.Location * obj[] -> Microsoft.CodeAnalysis.Diagnostic
Public Shared Function Create (descriptor As DiagnosticDescriptor, location As Location, ParamArray messageArgs As Object()) As Diagnostic
參數
- descriptor
- DiagnosticDescriptor
描述 DiagnosticDescriptor 診斷的
- messageArgs
- Object[]
診斷訊息的引數
傳回
Diagnostic 執行個體。
適用於
Create(DiagnosticDescriptor, Location, IEnumerable<Location>, Object[])
建立 Diagnostic 執行個體。
public:
static Microsoft::CodeAnalysis::Diagnostic ^ Create(Microsoft::CodeAnalysis::DiagnosticDescriptor ^ descriptor, Microsoft::CodeAnalysis::Location ^ location, System::Collections::Generic::IEnumerable<Microsoft::CodeAnalysis::Location ^> ^ additionalLocations, ... cli::array <System::Object ^> ^ messageArgs);
public static Microsoft.CodeAnalysis.Diagnostic Create (Microsoft.CodeAnalysis.DiagnosticDescriptor descriptor, Microsoft.CodeAnalysis.Location location, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Location> additionalLocations, params object[] messageArgs);
public static Microsoft.CodeAnalysis.Diagnostic Create (Microsoft.CodeAnalysis.DiagnosticDescriptor descriptor, Microsoft.CodeAnalysis.Location? location, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Location>? additionalLocations, params object?[]? messageArgs);
public static Microsoft.CodeAnalysis.Diagnostic Create (Microsoft.CodeAnalysis.DiagnosticDescriptor descriptor, Microsoft.CodeAnalysis.Location location, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Location>? additionalLocations, params object?[] messageArgs);
static member Create : Microsoft.CodeAnalysis.DiagnosticDescriptor * Microsoft.CodeAnalysis.Location * seq<Microsoft.CodeAnalysis.Location> * obj[] -> Microsoft.CodeAnalysis.Diagnostic
Public Shared Function Create (descriptor As DiagnosticDescriptor, location As Location, additionalLocations As IEnumerable(Of Location), ParamArray messageArgs As Object()) As Diagnostic
參數
- descriptor
- DiagnosticDescriptor
描述 DiagnosticDescriptor 診斷的 。
- additionalLocations
- IEnumerable<Location>
一組與診斷相關的其他位置。 這些通常是訊息中所參考之其他專案的位置。 如果為 null, AdditionalLocations 則會傳回空的清單。
- messageArgs
- Object[]
診斷訊息的引數。
傳回
Diagnostic 執行個體。
適用於
Create(DiagnosticDescriptor, Location, ImmutableDictionary<String,String>, Object[])
建立 Diagnostic 執行個體。
public:
static Microsoft::CodeAnalysis::Diagnostic ^ Create(Microsoft::CodeAnalysis::DiagnosticDescriptor ^ descriptor, Microsoft::CodeAnalysis::Location ^ location, System::Collections::Immutable::ImmutableDictionary<System::String ^, System::String ^> ^ properties, ... cli::array <System::Object ^> ^ messageArgs);
public static Microsoft.CodeAnalysis.Diagnostic Create (Microsoft.CodeAnalysis.DiagnosticDescriptor descriptor, Microsoft.CodeAnalysis.Location location, System.Collections.Immutable.ImmutableDictionary<string,string> properties, params object[] messageArgs);
public static Microsoft.CodeAnalysis.Diagnostic Create (Microsoft.CodeAnalysis.DiagnosticDescriptor descriptor, Microsoft.CodeAnalysis.Location? location, System.Collections.Immutable.ImmutableDictionary<string,string?>? properties, params object?[]? messageArgs);
public static Microsoft.CodeAnalysis.Diagnostic Create (Microsoft.CodeAnalysis.DiagnosticDescriptor descriptor, Microsoft.CodeAnalysis.Location location, System.Collections.Immutable.ImmutableDictionary<string,string>? properties, params object?[] messageArgs);
static member Create : Microsoft.CodeAnalysis.DiagnosticDescriptor * Microsoft.CodeAnalysis.Location * System.Collections.Immutable.ImmutableDictionary<string, string> * obj[] -> Microsoft.CodeAnalysis.Diagnostic
Public Shared Function Create (descriptor As DiagnosticDescriptor, location As Location, properties As ImmutableDictionary(Of String, String), ParamArray messageArgs As Object()) As Diagnostic
參數
- descriptor
- DiagnosticDescriptor
描述 DiagnosticDescriptor 診斷的 。
- properties
- ImmutableDictionary<String,String>
選擇性的一組名稱/值組,可藉由建立診斷的分析器,將更詳細的資訊傳達給修正程式。 如果為 null, Properties 將會傳回 Empty 。
- messageArgs
- Object[]
診斷訊息的引數。
傳回
Diagnostic 執行個體。
適用於
Create(DiagnosticDescriptor, Location, IEnumerable<Location>, ImmutableDictionary<String,String>, Object[])
建立 Diagnostic 執行個體。
public:
static Microsoft::CodeAnalysis::Diagnostic ^ Create(Microsoft::CodeAnalysis::DiagnosticDescriptor ^ descriptor, Microsoft::CodeAnalysis::Location ^ location, System::Collections::Generic::IEnumerable<Microsoft::CodeAnalysis::Location ^> ^ additionalLocations, System::Collections::Immutable::ImmutableDictionary<System::String ^, System::String ^> ^ properties, ... cli::array <System::Object ^> ^ messageArgs);
public static Microsoft.CodeAnalysis.Diagnostic Create (Microsoft.CodeAnalysis.DiagnosticDescriptor descriptor, Microsoft.CodeAnalysis.Location location, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Location> additionalLocations, System.Collections.Immutable.ImmutableDictionary<string,string> properties, params object[] messageArgs);
public static Microsoft.CodeAnalysis.Diagnostic Create (Microsoft.CodeAnalysis.DiagnosticDescriptor descriptor, Microsoft.CodeAnalysis.Location? location, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Location>? additionalLocations, System.Collections.Immutable.ImmutableDictionary<string,string?>? properties, params object?[]? messageArgs);
public static Microsoft.CodeAnalysis.Diagnostic Create (Microsoft.CodeAnalysis.DiagnosticDescriptor descriptor, Microsoft.CodeAnalysis.Location location, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Location>? additionalLocations, System.Collections.Immutable.ImmutableDictionary<string,string>? properties, params object?[] messageArgs);
static member Create : Microsoft.CodeAnalysis.DiagnosticDescriptor * Microsoft.CodeAnalysis.Location * seq<Microsoft.CodeAnalysis.Location> * System.Collections.Immutable.ImmutableDictionary<string, string> * obj[] -> Microsoft.CodeAnalysis.Diagnostic
Public Shared Function Create (descriptor As DiagnosticDescriptor, location As Location, additionalLocations As IEnumerable(Of Location), properties As ImmutableDictionary(Of String, String), ParamArray messageArgs As Object()) As Diagnostic
參數
- descriptor
- DiagnosticDescriptor
描述 DiagnosticDescriptor 診斷的 。
- additionalLocations
- IEnumerable<Location>
一組與診斷相關的其他位置。 這些通常是訊息中所參考之其他專案的位置。 如果為 null, AdditionalLocations 則會傳回空的清單。
- properties
- ImmutableDictionary<String,String>
選擇性的一組名稱/值組,可藉由建立診斷的分析器,將更詳細的資訊傳達給修正程式。 如果為 null, Properties 將會傳回 Empty 。
- messageArgs
- Object[]
診斷訊息的引數。
傳回
Diagnostic 執行個體。
適用於
Create(DiagnosticDescriptor, Location, DiagnosticSeverity, IEnumerable<Location>, ImmutableDictionary<String,String>, Object[])
建立 Diagnostic 執行個體。
public:
static Microsoft::CodeAnalysis::Diagnostic ^ Create(Microsoft::CodeAnalysis::DiagnosticDescriptor ^ descriptor, Microsoft::CodeAnalysis::Location ^ location, Microsoft::CodeAnalysis::DiagnosticSeverity effectiveSeverity, System::Collections::Generic::IEnumerable<Microsoft::CodeAnalysis::Location ^> ^ additionalLocations, System::Collections::Immutable::ImmutableDictionary<System::String ^, System::String ^> ^ properties, ... cli::array <System::Object ^> ^ messageArgs);
public static Microsoft.CodeAnalysis.Diagnostic Create (Microsoft.CodeAnalysis.DiagnosticDescriptor descriptor, Microsoft.CodeAnalysis.Location location, Microsoft.CodeAnalysis.DiagnosticSeverity effectiveSeverity, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Location> additionalLocations, System.Collections.Immutable.ImmutableDictionary<string,string> properties, params object[] messageArgs);
public static Microsoft.CodeAnalysis.Diagnostic Create (Microsoft.CodeAnalysis.DiagnosticDescriptor descriptor, Microsoft.CodeAnalysis.Location? location, Microsoft.CodeAnalysis.DiagnosticSeverity effectiveSeverity, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Location>? additionalLocations, System.Collections.Immutable.ImmutableDictionary<string,string?>? properties, params object?[]? messageArgs);
public static Microsoft.CodeAnalysis.Diagnostic Create (Microsoft.CodeAnalysis.DiagnosticDescriptor descriptor, Microsoft.CodeAnalysis.Location location, Microsoft.CodeAnalysis.DiagnosticSeverity effectiveSeverity, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Location>? additionalLocations, System.Collections.Immutable.ImmutableDictionary<string,string>? properties, params object?[] messageArgs);
static member Create : Microsoft.CodeAnalysis.DiagnosticDescriptor * Microsoft.CodeAnalysis.Location * Microsoft.CodeAnalysis.DiagnosticSeverity * seq<Microsoft.CodeAnalysis.Location> * System.Collections.Immutable.ImmutableDictionary<string, string> * obj[] -> Microsoft.CodeAnalysis.Diagnostic
Public Shared Function Create (descriptor As DiagnosticDescriptor, location As Location, effectiveSeverity As DiagnosticSeverity, additionalLocations As IEnumerable(Of Location), properties As ImmutableDictionary(Of String, String), ParamArray messageArgs As Object()) As Diagnostic
參數
- descriptor
- DiagnosticDescriptor
描述 DiagnosticDescriptor 診斷的 。
- effectiveSeverity
- DiagnosticSeverity
診斷的有效嚴重性。
- additionalLocations
- IEnumerable<Location>
一組與診斷相關的其他位置。 這些通常是訊息中所參考之其他專案的位置。 如果為 null, AdditionalLocations 則會傳回空的清單。
- properties
- ImmutableDictionary<String,String>
選擇性的一組名稱/值組,可藉由建立診斷的分析器,將更詳細的資訊傳達給修正程式。 如果為 null, Properties 將會傳回 Empty 。
- messageArgs
- Object[]
診斷訊息的引數。
傳回
Diagnostic 執行個體。
適用於
Create(String, String, LocalizableString, DiagnosticSeverity, DiagnosticSeverity, Boolean, Int32, LocalizableString, LocalizableString, String, Location, IEnumerable<Location>, IEnumerable<String>, ImmutableDictionary<String,String>)
建立 Diagnostic 可當地語系化的實例。
public static Microsoft.CodeAnalysis.Diagnostic Create (string id, string category, Microsoft.CodeAnalysis.LocalizableString message, Microsoft.CodeAnalysis.DiagnosticSeverity severity, Microsoft.CodeAnalysis.DiagnosticSeverity defaultSeverity, bool isEnabledByDefault, int warningLevel, Microsoft.CodeAnalysis.LocalizableString title = default, Microsoft.CodeAnalysis.LocalizableString description = default, string helpLink = default, Microsoft.CodeAnalysis.Location location = default, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Location> additionalLocations = default, System.Collections.Generic.IEnumerable<string> customTags = default, System.Collections.Immutable.ImmutableDictionary<string,string> properties = default);
public static Microsoft.CodeAnalysis.Diagnostic Create (string id, string category, Microsoft.CodeAnalysis.LocalizableString message, Microsoft.CodeAnalysis.DiagnosticSeverity severity, Microsoft.CodeAnalysis.DiagnosticSeverity defaultSeverity, bool isEnabledByDefault, int warningLevel, Microsoft.CodeAnalysis.LocalizableString? title = default, Microsoft.CodeAnalysis.LocalizableString? description = default, string? helpLink = default, Microsoft.CodeAnalysis.Location? location = default, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Location>? additionalLocations = default, System.Collections.Generic.IEnumerable<string>? customTags = default, System.Collections.Immutable.ImmutableDictionary<string,string?>? properties = default);
public static Microsoft.CodeAnalysis.Diagnostic Create (string id, string category, Microsoft.CodeAnalysis.LocalizableString message, Microsoft.CodeAnalysis.DiagnosticSeverity severity, Microsoft.CodeAnalysis.DiagnosticSeverity defaultSeverity, bool isEnabledByDefault, int warningLevel, Microsoft.CodeAnalysis.LocalizableString? title = default, Microsoft.CodeAnalysis.LocalizableString? description = default, string? helpLink = default, Microsoft.CodeAnalysis.Location? location = default, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Location>? additionalLocations = default, System.Collections.Generic.IEnumerable<string>? customTags = default, System.Collections.Immutable.ImmutableDictionary<string,string>? properties = default);
static member Create : string * string * Microsoft.CodeAnalysis.LocalizableString * Microsoft.CodeAnalysis.DiagnosticSeverity * Microsoft.CodeAnalysis.DiagnosticSeverity * bool * int * Microsoft.CodeAnalysis.LocalizableString * Microsoft.CodeAnalysis.LocalizableString * string * Microsoft.CodeAnalysis.Location * seq<Microsoft.CodeAnalysis.Location> * seq<string> * System.Collections.Immutable.ImmutableDictionary<string, string> -> Microsoft.CodeAnalysis.Diagnostic
Public Shared Function Create (id As String, category As String, message As LocalizableString, severity As DiagnosticSeverity, defaultSeverity As DiagnosticSeverity, isEnabledByDefault As Boolean, warningLevel As Integer, Optional title As LocalizableString = Nothing, Optional description As LocalizableString = Nothing, Optional helpLink As String = Nothing, Optional location As Location = Nothing, Optional additionalLocations As IEnumerable(Of Location) = Nothing, Optional customTags As IEnumerable(Of String) = Nothing, Optional properties As ImmutableDictionary(Of String, String) = Nothing) As Diagnostic
參數
- id
- String
診斷的識別碼。 針對編譯器所產生的診斷,這會是具有前置詞的數位程式碼,例如 「CS1001」。
- category
- String
診斷的類別。 針對編譯器所產生的診斷,類別會是「編譯器」。
- message
- LocalizableString
診斷訊息文字。
- severity
- DiagnosticSeverity
診斷的有效嚴重性。
- defaultSeverity
- DiagnosticSeverity
診斷的預設嚴重性。
- isEnabledByDefault
- Boolean
如果預設啟用診斷,則為 True
- title
- LocalizableString
描述診斷的選擇性簡短可當地語系化標題。
- description
- LocalizableString
診斷的選擇性較長可當地語系化描述。
- helpLink
- String
選擇性超連結,提供有關診斷的詳細資訊。
- additionalLocations
- IEnumerable<Location>
一組與診斷相關的其他位置。 這些通常是訊息中所參考之其他專案的位置。 如果為 null, AdditionalLocations 則會傳回空的清單。
- customTags
- IEnumerable<String>
診斷的一組選擇性自訂標記。 如需一些已知的標記,請參閱 WellKnownDiagnosticTags 。 如果為 null, Microsoft.CodeAnalysis.Diagnostic.CustomTags 則會傳回空的清單。
- properties
- ImmutableDictionary<String,String>
選擇性的一組名稱/值組,可藉由建立診斷的分析器,將更詳細的資訊傳達給修正程式。 如果為 null, Properties 將會傳回 Empty 。
傳回
Diagnostic 執行個體。
適用於
Create(String, String, LocalizableString, DiagnosticSeverity, DiagnosticSeverity, Boolean, Int32, Boolean, LocalizableString, LocalizableString, String, Location, IEnumerable<Location>, IEnumerable<String>, ImmutableDictionary<String,String>)
Diagnostic建立可當地語系化的實例。
public static Microsoft.CodeAnalysis.Diagnostic Create (string id, string category, Microsoft.CodeAnalysis.LocalizableString message, Microsoft.CodeAnalysis.DiagnosticSeverity severity, Microsoft.CodeAnalysis.DiagnosticSeverity defaultSeverity, bool isEnabledByDefault, int warningLevel, bool isSuppressed, Microsoft.CodeAnalysis.LocalizableString title = default, Microsoft.CodeAnalysis.LocalizableString description = default, string helpLink = default, Microsoft.CodeAnalysis.Location location = default, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Location> additionalLocations = default, System.Collections.Generic.IEnumerable<string> customTags = default, System.Collections.Immutable.ImmutableDictionary<string,string> properties = default);
public static Microsoft.CodeAnalysis.Diagnostic Create (string id, string category, Microsoft.CodeAnalysis.LocalizableString message, Microsoft.CodeAnalysis.DiagnosticSeverity severity, Microsoft.CodeAnalysis.DiagnosticSeverity defaultSeverity, bool isEnabledByDefault, int warningLevel, bool isSuppressed, Microsoft.CodeAnalysis.LocalizableString? title = default, Microsoft.CodeAnalysis.LocalizableString? description = default, string? helpLink = default, Microsoft.CodeAnalysis.Location? location = default, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Location>? additionalLocations = default, System.Collections.Generic.IEnumerable<string>? customTags = default, System.Collections.Immutable.ImmutableDictionary<string,string?>? properties = default);
public static Microsoft.CodeAnalysis.Diagnostic Create (string id, string category, Microsoft.CodeAnalysis.LocalizableString message, Microsoft.CodeAnalysis.DiagnosticSeverity severity, Microsoft.CodeAnalysis.DiagnosticSeverity defaultSeverity, bool isEnabledByDefault, int warningLevel, bool isSuppressed, Microsoft.CodeAnalysis.LocalizableString? title = default, Microsoft.CodeAnalysis.LocalizableString? description = default, string? helpLink = default, Microsoft.CodeAnalysis.Location? location = default, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Location>? additionalLocations = default, System.Collections.Generic.IEnumerable<string>? customTags = default, System.Collections.Immutable.ImmutableDictionary<string,string>? properties = default);
static member Create : string * string * Microsoft.CodeAnalysis.LocalizableString * Microsoft.CodeAnalysis.DiagnosticSeverity * Microsoft.CodeAnalysis.DiagnosticSeverity * bool * int * bool * Microsoft.CodeAnalysis.LocalizableString * Microsoft.CodeAnalysis.LocalizableString * string * Microsoft.CodeAnalysis.Location * seq<Microsoft.CodeAnalysis.Location> * seq<string> * System.Collections.Immutable.ImmutableDictionary<string, string> -> Microsoft.CodeAnalysis.Diagnostic
Public Shared Function Create (id As String, category As String, message As LocalizableString, severity As DiagnosticSeverity, defaultSeverity As DiagnosticSeverity, isEnabledByDefault As Boolean, warningLevel As Integer, isSuppressed As Boolean, Optional title As LocalizableString = Nothing, Optional description As LocalizableString = Nothing, Optional helpLink As String = Nothing, Optional location As Location = Nothing, Optional additionalLocations As IEnumerable(Of Location) = Nothing, Optional customTags As IEnumerable(Of String) = Nothing, Optional properties As ImmutableDictionary(Of String, String) = Nothing) As Diagnostic
參數
- id
- String
診斷的識別碼。 針對編譯器所產生的診斷,這會是具有前置詞的數位程式碼,例如 「CS1001」。
- category
- String
診斷的類別。 針對編譯器所產生的診斷,類別會是「編譯器」。
- message
- LocalizableString
診斷訊息文字。
- severity
- DiagnosticSeverity
診斷的有效嚴重性。
- defaultSeverity
- DiagnosticSeverity
診斷的預設嚴重性。
- isEnabledByDefault
- Boolean
如果預設啟用診斷,則為 True
- isSuppressed
- Boolean
旗標,指出診斷是否由來源隱藏所隱藏。
- title
- LocalizableString
描述診斷的選擇性簡短可當地語系化標題。
- description
- LocalizableString
診斷的選擇性較長可當地語系化描述。
- helpLink
- String
選擇性超連結,提供有關診斷的詳細資訊。
- additionalLocations
- IEnumerable<Location>
一組與診斷相關的其他位置。 一般而言,這些是訊息中所參考之其他專案的位置。 如果為 null, AdditionalLocations 則會傳回空的清單。
- customTags
- IEnumerable<String>
診斷的一組選擇性自訂標籤。 如需一些已知的標籤,請參閱 WellKnownDiagnosticTags 。 如果為 null, Microsoft.CodeAnalysis.Diagnostic.CustomTags 則會傳回空的清單。
- properties
- ImmutableDictionary<String,String>
一組選擇性的名稱/值組,可藉由建立診斷的分析器,將更詳細的資訊傳達給修正程式。 如果為 null, Properties 則會傳回 Empty 。
傳回
Diagnostic 執行個體。