Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 26 additions & 36 deletions src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1491,50 +1491,24 @@ public async IAsyncEnumerable<SourceFile> Load(SessionId id, string[] loaded_fil

foreach (string url in asm_files)
{
try
{
string candidate_pdb = Path.ChangeExtension(url, "pdb");
string pdb = pdb_files.FirstOrDefault(n => n == candidate_pdb);
string candidate_pdb = Path.ChangeExtension(url, "pdb");
string pdb = pdb_files.FirstOrDefault(n => n == candidate_pdb);

steps.Add(
new DebugItem
{
Url = url,
Data = Task.WhenAll(MonoProxy.HttpClient.GetByteArrayAsync(url, token), pdb != null ? MonoProxy.HttpClient.GetByteArrayAsync(pdb, token) : Task.FromResult<byte[]>(null))
});
}
catch (Exception e)
{
if (tryUseDebuggerProtocol)
{
try
{
string unescapedFileName = Uri.UnescapeDataString(url);
steps.Add(
new DebugItem
{
Url = url,
Data = context.SdbAgent.GetBytesFromAssemblyAndPdb(Path.GetFileName(unescapedFileName), token)
});
}
catch (Exception ex)
{
logger.LogDebug($"Failed to get bytes using debugger protocol {url} ({ex.Message})");
}
}
else
steps.Add(
new DebugItem
{
logger.LogDebug($"Failed to read {url} ({e.Message})");
}
}
Url = url,
Data = Task.WhenAll(MonoProxy.HttpClient.GetByteArrayAsync(url, token), pdb != null ? MonoProxy.HttpClient.GetByteArrayAsync(pdb, token) : Task.FromResult<byte[]>(null))
});
}

foreach (DebugItem step in steps)
{
AssemblyInfo assembly = null;
byte[][] bytes;
try
{
byte[][] bytes = await step.Data.ConfigureAwait(false);
bytes = await step.Data.ConfigureAwait(false);
if (bytes[0] == null)
{
logger.LogDebug($"Bytes from assembly {step.Url} is NULL");
Expand All @@ -1544,7 +1518,23 @@ public async IAsyncEnumerable<SourceFile> Load(SessionId id, string[] loaded_fil
}
catch (Exception e)
{
logger.LogError($"Failed to load {step.Url} ({e.Message})");
try
{
if (tryUseDebuggerProtocol)
{
string unescapedFileName = Uri.UnescapeDataString(step.Url);
bytes = await context.SdbAgent.GetBytesFromAssemblyAndPdb(Path.GetFileName(unescapedFileName), token);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConfigureAwait(false)

assembly = new AssemblyInfo(monoProxy, id, step.Url, bytes[0], bytes[1], logger, token);
}
else
{
logger.LogDebug($"Failed to read {step.Url} ({e.Message})");
}
}
catch (Exception ex)
{
logger.LogError($"Failed to load {step.Url} ({ex.Message})");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering why ex is not passed as an argument to LogError? This might provide the user with more information?

}
}
if (assembly == null)
continue;
Expand Down