@@ -184,6 +184,7 @@ protected override async Task<bool> AcceptCommand (MessageId id, string method,
184184 }
185185
186186 var bpid = resp . Value [ "breakpointId" ] ? . ToString ( ) ;
187+ var locations = resp . Value [ "locations" ] ? . Values < object > ( ) ;
187188 var request = BreakpointRequest . Parse ( bpid , args ) ;
188189 context . BreakpointRequests [ bpid ] = request ;
189190 if ( await IsRuntimeAlreadyReadyAlready ( id , token ) ) {
@@ -193,7 +194,8 @@ protected override async Task<bool> AcceptCommand (MessageId id, string method,
193194 await SetBreakpoint ( id , store , request , token ) ;
194195 }
195196
196- SendResponse ( id , Result . OkFromObject ( request . AsSetBreakpointByUrlResponse ( ) ) , token ) ;
197+ var result = Result . OkFromObject ( request . AsSetBreakpointByUrlResponse ( locations ) ) ;
198+ SendResponse ( id , result , token ) ;
197199 return true ;
198200 }
199201
@@ -765,17 +767,21 @@ async Task SetBreakpoint (SessionId sessionId, DebugStore store, BreakpointReque
765767 return ;
766768 }
767769
768- var locations = store . FindBreakpointLocations ( req ) . ToList ( ) ;
770+ var comparer = new SourceLocation . LocationComparer ( ) ;
771+ // if column is specified the frontend wants the exact matches
772+ // and will clear the bp if it isn't close enoug
773+ var locations = store . FindBreakpointLocations ( req )
774+ . Distinct ( comparer )
775+ . Where ( l => l . Line == req . Line && ( req . Column == 0 || l . Column == req . Column ) )
776+ . OrderBy ( l => l . Column )
777+ . GroupBy ( l => l . Id ) ;
778+
769779 logger . LogDebug ( "BP request for '{req}' runtime ready {context.RuntimeReady}" , req , GetContext ( sessionId ) . IsRuntimeReady ) ;
770780
771781 var breakpoints = new List < Breakpoint > ( ) ;
772782
773- // if column is specified the frontend wants the exact matches
774- // and will clear the bp if it isn't close enough
775- if ( req . Column != 0 )
776- locations = locations . Where ( l => l . Column == req . Column ) . ToList ( ) ;
777-
778- foreach ( var loc in locations ) {
783+ foreach ( var sourceId in locations ) {
784+ var loc = sourceId . First ( ) ;
779785 var bp = await SetMonoBreakpoint ( sessionId , req . Id , loc , token ) ;
780786
781787 // If we didn't successfully enable the breakpoint
0 commit comments