Skip to content

[release/7.0] Fixes not find assembly and pdb if it's not using the default path #92955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 16, 2023
Merged
Changes from all commits
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).ConfigureAwait(false);
assembly = new AssemblyInfo(monoProxy, id, step.Url, bytes[0], bytes[1], logger, token);
}
else
{
logger.LogDebug($"Failed to read {step.Url} ({e})");
}
}
catch (Exception ex)
{
logger.LogError($"Failed to load {step.Url} ({ex})");
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

That's what I meant. I would expect that to should up in the output of the console application that is being launched when running the debugger? Now also wondering if the e should also be passed to the logger.LogDebug method.

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