验证给定位置作为线上设置断点。
命名空间: 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 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关详细信息,请参阅通过部分受信任的代码使用库。