共用方式為


DiagnosticCollection Constructor

Definition

Initializes a new instance of the DiagnosticCollection class.

public DiagnosticCollection (Uri documentMoniker, int documentVersionNumber, System.Collections.Generic.IReadOnlyList<Microsoft.VisualStudio.RpcContracts.DiagnosticManagement.Diagnostic> diagnostics, int? identifier = default, int? supersedes = default, Guid? outputKey = default);
new Microsoft.VisualStudio.RpcContracts.DiagnosticManagement.DiagnosticCollection : Uri * int * System.Collections.Generic.IReadOnlyList<Microsoft.VisualStudio.RpcContracts.DiagnosticManagement.Diagnostic> * Nullable<int> * Nullable<int> * Nullable<Guid> -> Microsoft.VisualStudio.RpcContracts.DiagnosticManagement.DiagnosticCollection
Public Sub New (documentMoniker As Uri, documentVersionNumber As Integer, diagnostics As IReadOnlyList(Of Diagnostic), Optional identifier As Nullable(Of Integer) = Nothing, Optional supersedes As Nullable(Of Integer) = Nothing, Optional outputKey As Nullable(Of Guid) = Nothing)

Parameters

documentMoniker
Uri

URI of the document containing the diagnostics. The URI is always a remote URI i.e. a URI that can be understood by both parties (server and client / host and guest) in shared scenarios.

documentVersionNumber
Int32

Version number of the document.

diagnostics
IReadOnlyList<Diagnostic>

List of diagnostics found in documentMoniker.

identifier
Nullable<Int32>

An identfier for this collection.

supersedes
Nullable<Int32>

The identifier of the DiagnosticCollection that is superceded by this collection.

outputKey
Nullable<Guid>

The output window key used to associate diagnostics in the collection with a line of text in the output window.

Remarks

DiagnosticCollections, when being reported via IDiagnosticManagerService, should use documentMoniker that correspond to the Uri that corresponds to the location of the document on the server.

DiagnosticCollection sent via the IDiagnosticViewerService will always use Uris that correspond to the remote moniker for the document.

Note that remote monikers can change when a LiveShare session starts or ends, so it is best to never persist a documents remote moniker: instead convert to a local file path and convert on demand.

Applies to