@@ -244,34 +244,31 @@ private async ValueTask<IVsDebugName> CreateDebugNameAsync(
244244
245245 public int ValidateBreakpointLocation ( IVsTextBuffer pBuffer , int iLine , int iCol , VsTextSpan [ ] pCodeSpan )
246246 {
247- using ( Logger . LogBlock ( FunctionId . Debugging_VsLanguageDebugInfo_ValidateBreakpointLocation , CancellationToken . None ) )
247+ return this . ThreadingContext . JoinableTaskFactory . Run ( async ( ) =>
248248 {
249- var result = VSConstants . E_NOTIMPL ;
250- _uiThreadOperationExecutor . Execute (
251- title : ServicesVSResources . Debugger ,
252- defaultDescription : ServicesVSResources . Validating_breakpoint_location ,
253- allowCancellation : true ,
254- showProgress : false ,
255- action : waitContext =>
249+ using ( Logger . LogBlock ( FunctionId . Debugging_VsLanguageDebugInfo_ValidateBreakpointLocation , CancellationToken . None ) )
256250 {
257- result = ValidateBreakpointLocationWorker ( pBuffer , iLine , iCol , pCodeSpan , waitContext . UserCancellationToken ) ;
258- } ) ;
251+ using var waitContext = _uiThreadOperationExecutor . BeginExecute (
252+ title : ServicesVSResources . Debugger ,
253+ defaultDescription : ServicesVSResources . Validating_breakpoint_location ,
254+ allowCancellation : true ,
255+ showProgress : false ) ;
259256
260- return result ;
261- }
257+ return await ValidateBreakpointLocationAsync (
258+ pBuffer , iLine , iCol , pCodeSpan , waitContext . UserCancellationToken ) . ConfigureAwait ( true ) ;
259+ }
260+ } ) ;
262261 }
263262
264- private int ValidateBreakpointLocationWorker (
263+ private async Task < int > ValidateBreakpointLocationAsync (
265264 IVsTextBuffer pBuffer ,
266265 int iLine ,
267266 int iCol ,
268267 VsTextSpan [ ] pCodeSpan ,
269268 CancellationToken cancellationToken )
270269 {
271270 if ( _breakpointService == null )
272- {
273271 return VSConstants . E_FAIL ;
274- }
275272
276273 var textBuffer = _languageService . EditorAdaptersFactoryService . GetDataBuffer ( pBuffer ) ;
277274 if ( textBuffer != null )
@@ -333,7 +330,8 @@ private int ValidateBreakpointLocationWorker(
333330 // NOTE(cyrusn): we need to wait here because ValidateBreakpointLocation is
334331 // synchronous. In the future, it would be nice for the debugger to provide
335332 // an async entry point for this.
336- var breakpoint = _breakpointService . ResolveBreakpointAsync ( document , new TextSpan ( point . Position , length ) , cancellationToken ) . WaitAndGetResult ( cancellationToken ) ;
333+ var breakpoint = await _breakpointService . ResolveBreakpointAsync (
334+ document , new TextSpan ( point . Position , length ) , cancellationToken ) . ConfigureAwait ( true ) ;
337335 if ( breakpoint == null )
338336 {
339337 // There should *not* be a breakpoint here. E_FAIL to let the debugger know
@@ -354,9 +352,7 @@ private int ValidateBreakpointLocationWorker(
354352
355353 // There should be a breakpoint at the location passed back.
356354 if ( pCodeSpan != null && pCodeSpan . Length > 0 )
357- {
358355 pCodeSpan [ 0 ] = breakpoint . TextSpan . ToSnapshotSpan ( snapshot ) . ToVsTextSpan ( ) ;
359- }
360356
361357 return VSConstants . S_OK ;
362358 }
0 commit comments