SequencePoint 구조체

정의

이식 가능한 PDB 시퀀스 지점을 나타냅니다.

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)
상속
SequencePoint
구현

예제

이 예제에서는 메타데이터 토큰으로 정의된 메서드의 시퀀스 지점을 읽고 원본 줄 매핑을 표시하는 방법을 보여 줍니다.

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));
        }
    }
}

설명

시퀀스 지점은 이 IL이 컴파일된 원본 문서의 IL 오프셋과 해당 줄 및 열 번호 간의 매핑을 포함하는 구조체입니다. 시퀀스 지점은 이식 가능한 PDB 디버깅 기호의 테이블에 저장 MethodDebugInformation 됩니다. 자세한 내용은 이식 가능한 PDB v1.0: 형식 사양을 참조하세요.

필드

HiddenLine

숨겨진 시퀀스 지점의 줄 번호 값을 지정합니다.

속성

Document

이 시퀀스 지점이 포함된 원본 문서를 가져옵니다.

EndColumn

이 시퀀스 지점에서 마지막 문자의 열 번호를 가져옵니다.

EndLine

이 시퀀스 지점의 마지막 문자 줄 번호를 가져옵니다.

IsHidden

이 시퀀스 지점이 숨겨져 있는지 여부를 나타내는 값을 가져옵니다.

Offset

메서드 본문의 시작 부분부터 바이트 단위로 이 시퀀스 지점의 IL 오프셋을 가져옵니다.

StartColumn

이 시퀀스 지점에서 첫 번째 문자의 열 번호를 가져옵니다.

StartLine

이 시퀀스 지점의 첫 번째 문자 줄 번호를 가져옵니다.

메서드

Equals(Object)

현재 시퀀스 지점이 지정된 개체와 같은지 여부를 나타냅니다.

Equals(SequencePoint)

현재 개체가 동일한 형식의 다른 개체와 같은지 여부를 나타냅니다.

GetHashCode()

이 시퀀스 지점의 해시 코드를 가져옵니다.

적용 대상