1using System.Collections.ObjectModel;
11 private readonly IReadOnlyDictionary<string, string> _values;
21 string? relatedPath =
null,
22 IReadOnlyDictionary<string, string>? values =
null,
23 string? suggestedAction =
null)
25 if (
string.IsNullOrWhiteSpace(code))
27 throw new ArgumentException(
28 "A diagnostic code is required.",
32 ArgumentNullException.ThrowIfNull(path);
33 ArgumentNullException.ThrowIfNull(message);
42 Dictionary<string, string> copy =
44 ?
new Dictionary<string, string>(
45 StringComparer.Ordinal)
46 :
new Dictionary<string, string>(
48 StringComparer.Ordinal);
51 new ReadOnlyDictionary<string, string>(copy);
57 public string Code {
get; }
67 public string Path {
get; }
82 public IReadOnlyDictionary<string, string>
Values => _values;
101 return $
"[{Severity}] {Code} at {Path}: {Message}";
bool IsBlocking
Gets a value indicating whether this diagnostic blocks the instance from being treated as semanticall...
string Code
Gets the stable technical code identifying the rule.
override string ToString()
IReadOnlyDictionary< string, string > Values
Gets stable contextual values associated with the rule.
string Path
Gets the logical path of the primary model element.
InstanceDiagnostic(string code, InstanceDiagnosticSeverity severity, string path, string message, string? relatedPath=null, IReadOnlyDictionary< string, string >? values=null, string? suggestedAction=null)
Initializes a structured instance diagnostic.
string? SuggestedAction
Gets an optional action suggested to the caller or UI.
string? RelatedPath
Gets an optional related logical path.
string Message
Gets the human-readable diagnostic message.
InstanceDiagnosticSeverity Severity
Gets the diagnostic severity.
InstanceDiagnosticSeverity
Indicates the severity of one semantic instance diagnostic.
@ Error
Blocking issue that prevents the instance from being considered semantically valid.