@@ -1475,61 +1475,56 @@ public IEnumerable<SourceFile> Add(SessionId id, string name, byte[] assembly_da
1475
1475
}
1476
1476
}
1477
1477
1478
- public async IAsyncEnumerable < SourceFile > Load ( SessionId id , string [ ] loaded_files , ExecutionContext context , bool useDebuggerProtocol , [ EnumeratorCancellation ] CancellationToken token )
1478
+ public async IAsyncEnumerable < SourceFile > Load ( SessionId id , string [ ] loaded_files , ExecutionContext context , bool tryUseDebuggerProtocol , [ EnumeratorCancellation ] CancellationToken token )
1479
1479
{
1480
1480
var asm_files = new List < string > ( ) ;
1481
1481
List < DebugItem > steps = new List < DebugItem > ( ) ;
1482
1482
1483
- if ( ! useDebuggerProtocol )
1483
+ var pdb_files = new List < string > ( ) ;
1484
+ foreach ( string file_name in loaded_files )
1484
1485
{
1485
- var pdb_files = new List < string > ( ) ;
1486
- foreach ( string file_name in loaded_files )
1487
- {
1488
- if ( file_name . EndsWith ( ".pdb" , StringComparison . OrdinalIgnoreCase ) )
1489
- pdb_files . Add ( file_name ) ;
1490
- else
1491
- asm_files . Add ( file_name ) ;
1492
- }
1486
+ if ( file_name . EndsWith ( ".pdb" , StringComparison . OrdinalIgnoreCase ) )
1487
+ pdb_files . Add ( file_name ) ;
1488
+ else
1489
+ asm_files . Add ( file_name ) ;
1490
+ }
1493
1491
1494
- foreach ( string url in asm_files )
1492
+ foreach ( string url in asm_files )
1493
+ {
1494
+ try
1495
1495
{
1496
- try
1497
- {
1498
- string candidate_pdb = Path . ChangeExtension ( url , "pdb" ) ;
1499
- string pdb = pdb_files . FirstOrDefault ( n => n == candidate_pdb ) ;
1496
+ string candidate_pdb = Path . ChangeExtension ( url , "pdb" ) ;
1497
+ string pdb = pdb_files . FirstOrDefault ( n => n == candidate_pdb ) ;
1500
1498
1501
- steps . Add (
1502
- new DebugItem
1503
- {
1504
- Url = url ,
1505
- Data = Task . WhenAll ( MonoProxy . HttpClient . GetByteArrayAsync ( url , token ) , pdb != null ? MonoProxy . HttpClient . GetByteArrayAsync ( pdb , token ) : Task . FromResult < byte [ ] > ( null ) )
1506
- } ) ;
1507
- }
1508
- catch ( Exception e )
1509
- {
1510
- logger . LogDebug ( $ "Failed to read { url } ({ e . Message } )") ;
1511
- }
1499
+ steps . Add (
1500
+ new DebugItem
1501
+ {
1502
+ Url = url ,
1503
+ Data = Task . WhenAll ( MonoProxy . HttpClient . GetByteArrayAsync ( url , token ) , pdb != null ? MonoProxy . HttpClient . GetByteArrayAsync ( pdb , token ) : Task . FromResult < byte [ ] > ( null ) )
1504
+ } ) ;
1512
1505
}
1513
- }
1514
- else
1515
- {
1516
- foreach ( string file_name in loaded_files )
1506
+ catch ( Exception e )
1517
1507
{
1518
- if ( file_name . EndsWith ( ".pdb" , StringComparison . OrdinalIgnoreCase ) )
1519
- continue ;
1520
- try
1508
+ if ( tryUseDebuggerProtocol )
1521
1509
{
1522
- string unescapedFileName = Uri . UnescapeDataString ( file_name ) ;
1523
- steps . Add (
1510
+ try
1511
+ {
1512
+ string unescapedFileName = Uri . UnescapeDataString ( url ) ;
1513
+ steps . Add (
1524
1514
new DebugItem
1525
1515
{
1526
- Url = file_name ,
1516
+ Url = url ,
1527
1517
Data = context . SdbAgent . GetBytesFromAssemblyAndPdb ( Path . GetFileName ( unescapedFileName ) , token )
1528
1518
} ) ;
1519
+ }
1520
+ catch ( Exception ex )
1521
+ {
1522
+ logger . LogDebug ( $ "Failed to get bytes using debugger protocol { url } ({ ex . Message } )") ;
1523
+ }
1529
1524
}
1530
- catch ( Exception e )
1525
+ else
1531
1526
{
1532
- logger . LogDebug ( $ "Failed to read { file_name } ({ e . Message } )") ;
1527
+ logger . LogDebug ( $ "Failed to read { url } ({ e . Message } )") ;
1533
1528
}
1534
1529
}
1535
1530
}
0 commit comments