SequencePoint Struct
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a Portable PDB sequence point.
public value class SequencePoint : IEquatable<System::Reflection::Metadata::SequencePoint>
public readonly struct SequencePoint : IEquatable<System.Reflection.Metadata.SequencePoint>
public struct SequencePoint : IEquatable<System.Reflection.Metadata.SequencePoint>
type SequencePoint = struct
Public Structure SequencePoint
Implements IEquatable(Of SequencePoint)
- Inheritance
- Implements
This example shows how to read sequence points of the method defined by the metadata token and display its source line mappings:
public static void ReadSourceLineData(string pdbPath, int methodToken)
{
// Determine method row number
EntityHandle ehMethod = MetadataTokens.EntityHandle(methodToken);
if (ehMethod.Kind != HandleKind.MethodDefinition)
{
Console.WriteLine($"Invalid token kind: {ehMethod.Kind}");
return;
}
int rowNumber = MetadataTokens.GetRowNumber(ehMethod);
// MethodDebugInformation table is indexed by same row numbers as MethodDefinition table
MethodDebugInformationHandle hDebug = MetadataTokens.MethodDebugInformationHandle(rowNumber);
// Open Portable PDB file
using var fs = new FileStream(pdbPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
using MetadataReaderProvider provider = MetadataReaderProvider.FromPortablePdbStream(fs);
MetadataReader reader = provider.GetMetadataReader();
if (rowNumber > reader.MethodDebugInformation.Count)
{
Console.WriteLine("Error: Method row number is out of range");
return;
}
// Print source line information as console table
MethodDebugInformation di = reader.GetMethodDebugInformation(hDebug);
Console.WriteLine("IL offset | Start line | Start col. | End line | End col. |");
foreach (SequencePoint sp in di.GetSequencePoints())
{
if (sp.IsHidden)
{
Console.WriteLine($"{sp.Offset.ToString().PadLeft(9)} | (hidden sequence point)");
}
else
{
Console.WriteLine("{0} |{1} |{2} |{3} |{4} |",
sp.Offset.ToString().PadLeft(9),
sp.StartLine.ToString().PadLeft(11),
sp.StartColumn.ToString().PadLeft(11),
sp.EndLine.ToString().PadLeft(9),
sp.EndColumn.ToString().PadLeft(9));
}
}
}
Sequence point is a structure that contains the mapping between IL offset and corresponding line and column numbers in a source document this IL was compiled from. Sequence points are stored in the MethodDebugInformation
table of Portable PDB debugging symbols. For more information, see Portable PDB v1.0: Format Specification.
Hidden |
Specifies a line number value for a hidden sequence point. |
Document |
Gets the source document that contains this sequence point. |
End |
Gets the column number of the last character in this sequence point. |
End |
Gets the line number of the last character in this sequence point. |
Is |
Gets a value that indicates whether this sequence point is hidden. |
Offset |
Gets the IL offset of this sequence point from the start of the method body, in bytes. |
Start |
Gets the column number of the first character in this sequence point. |
Start |
Gets the line number of the first character in this sequence point. |
Equals(Object) |
Indicates whether the current sequence point is equal to the specified object. |
Equals(Sequence |
Indicates whether the current object is equal to another object of the same type. |
Get |
Gets the hash code of this sequence point. |
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback: