Show / Hide Table of Contents

Delegate DtdlResolveLocator

A delegate to be provided by code that uses the ModelParser for converting a resolve DTMI and line number into a source name and line number.

Namespace: DTDLParser
Assembly: DTDLParser.dll
Syntax
public delegate bool DtdlResolveLocator(Dtmi resolveDtmi, int resolveLine, out string sourceName, out int sourceLine)
Parameters
Type Name Description
Dtmi resolveDtmi

The identifier whose defininition was requested through the DtmiResolver or DtmiResolverAsync.

int resolveLine

A line number within the JSON text definition string indicated by the resolve DTMI.

string sourceName

The source name corresponding to the resolve DTMI and line number.

int sourceLine

The soure line number corresponding to the resolve DTMI and line number.

Returns
Type Description
bool

True if the source information could be obtained.

Remarks

This delegate is used to enhance the reporting of errors in DTDL models. A DtdlResolveLocator can be defined and passed into the constructor of a ModelParser instance. When the ModelParser encounters an error in a definition returned by the DtmiResolver or DtmiResolverAsync, it calls the delegate with a resolveDtmi indicating the identifer that was resolved with the relevant definition and a resolveLine indicating a line number within this definition. If the delegate is able to convert these values into a user-meaningful location, it should set the out-parameter sourceName to the name of the appropriate source file, URL, etc.; set the out-parameter sourceLine to the corresponding line number within this source; and return a value of true. If it is not able to perform the conversion, it should return a value of false.

  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX