IVsLanguageDebugInfo.ValidateBreakpointLocation 方法
驗證指定的位置,用來設定中斷點。
命名空間: Microsoft.VisualStudio.TextManager.Interop
組件: Microsoft.VisualStudio.TextManager.Interop (在 Microsoft.VisualStudio.TextManager.Interop.dll 中)
語法
'宣告
Function ValidateBreakpointLocation ( _
pBuffer As IVsTextBuffer, _
iLine As Integer, _
iCol As Integer, _
<OutAttribute> pCodeSpan As TextSpan() _
) As Integer
int ValidateBreakpointLocation(
IVsTextBuffer pBuffer,
int iLine,
int iCol,
TextSpan[] pCodeSpan
)
int ValidateBreakpointLocation(
[InAttribute] IVsTextBuffer^ pBuffer,
[InAttribute] int iLine,
[InAttribute] int iCol,
[OutAttribute] array<TextSpan>^ pCodeSpan
)
abstract ValidateBreakpointLocation :
pBuffer:IVsTextBuffer *
iLine:int *
iCol:int *
pCodeSpan:TextSpan[] byref -> int
function ValidateBreakpointLocation(
pBuffer : IVsTextBuffer,
iLine : int,
iCol : int,
pCodeSpan : TextSpan[]
) : int
參數
pBuffer
類型:Microsoft.VisualStudio.TextManager.Interop.IVsTextBuffer[in]IVsTextBuffer文字緩衝區,包含中斷點的介面。
iLine
類型:Int32[in]包含中斷點的行號。
iCol
類型:Int32[in]包含中斷點的資料行數目。
pCodeSpan
類型:array<Microsoft.VisualStudio.TextManager.Interop.TextSpan[][] out傳回文字串的頻率如果已設定中斷點,就會停止執行的陳述式的範圍的之內。
傳回值
類型:Int32
如果此方法將會成功,則會傳回S_OK。如果失敗,它就會傳回錯誤碼。
備註
COM 簽章
從 textmgr.idl:
HRESULT IVsLanguageDebugInfo::ValidateBreakpointLocation(
[in] IVsTextBuffer *pBuffer,
[in] long iLine,
[in] long iCol, ]
[out] TextSpan *pCodeSpan
);
這個方法會驗證指定的位置,用來設定中斷點,而不需要載入偵錯工具。 如果是有效的位置,以頻率會停止執行的陳述式的範圍中填滿範圍。 如果位置已知不包含程式碼,則這個方法會傳回S_FALSE。 如果方法失敗時,設定中斷點,暫止的偵錯工具啟動時的驗證。
警告
即使您不想支援ValidateBreakpointLocation方法,但您的語言不支援中斷點,您必須實作這個方法,並傳回的範圍,其中包含指定的行和欄。 否則,中斷點不能設定任何一處除了第 1 行。您可能會傳回E_NOTIMPL ,表示您並不支援這個方法,但範圍一定要先設定。此範例顯示如何完成。
範例
以下是部分範例,可以如何實作這個方法。 這個範例會示範如何設定設為預設值的範圍,讓中斷點適當地運作。
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.TextManager.Interop;
namespace MyLanguagePackage
{
public class MyLanguageService : IVsLanguageInfo, IVsLanguageDebugInfo
{
public int ValidateBreakpointLocation(IVsTextBuffer buffer,
int line,
int col,
TextSpan[] pCodeSpan)
{
int retval = VSConstants.E_NOTIMPL;
if (pCodeSpan != null)
{
// Make sure the span is set to at least the current
// position by default.
pCodeSpan[0].iStartLine = line;
pCodeSpan[0].iStartIndex = col;
pCodeSpan[0].iEndLine = line;
pCodeSpan[0].iEndIndex = col;
}
if (buffer != null)
{
// Use your parser to obtain the span that describes the
// the code containing the specified position. If the span
// is valid, return S_OK with the valid span; otherwise,
// returns S_FALSE (leaving the default span alone).
//
// GetCodeSpanForLocation() is a helper function not shown.
retval = VSConstants.S_FALSE;
TextSpan span = new TextSpan();
if (GetCodeSpanForLocation(buffer, line, col, out span))
{
pCodeSpan[0] = span;
retval = VSConstants.S_OK;
}
}
return retval;
}
}
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。