Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 7 additions & 8 deletions src/mono/mono/component/hot_reload.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -2118,6 +2118,13 @@ apply_enclog_pass2 (Pass2Context *ctx, MonoImage *image_base, BaselineInfo *base
if (func_code == ENC_FUNC_ADD_PARAM)
break;

if (!base_info->method_table_update)
base_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_table_update)
delta_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_ppdb_table_update)
delta_info->method_ppdb_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);

if (is_addition) {
g_assertf (add_member_typedef, "EnC: new method added but I don't know the class, should be caught by pass1");
if (pass2_context_is_skeleton (ctx, add_member_typedef)) {
Expand All@@ -2139,14 +2146,6 @@ apply_enclog_pass2 (Pass2Context *ctx, MonoImage *image_base, BaselineInfo *base
add_member_typedef = 0;
}

if (!base_info->method_table_update)
base_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_table_update)
delta_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_ppdb_table_update)

delta_info->method_ppdb_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);

int mapped_token = hot_reload_relative_delta_index (image_dmeta, delta_info, mono_metadata_make_token (token_table, token_index));
guint32 rva = mono_metadata_decode_row_col (&image_dmeta->tables [MONO_TABLE_METHOD], mapped_token - 1, MONO_METHOD_RVA);
if (rva < dil_length) {
Expand Down
10 changes: 5 additions & 5 deletions src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -996,7 +996,7 @@ private void PopulateEnC(MetadataReader asmMetadataReaderParm, MetadataReader pd
{
var document = pdbMetadataReaderParm.GetDocument(methodDebugInformation.Document);
var documentName = pdbMetadataReaderParm.GetString(document.Name);
source = GetOrAddSourceFile(methodDebugInformation.Document, asmMetadataReaderParm.GetRowNumber(methodDebugInformation.Document), documentName);
source = GetOrAddSourceFile(methodDebugInformation.Document, documentName);
}
var methodInfo = new MethodInfo(this, MetadataTokens.MethodDefinitionHandle(methodIdxAsm), entryRow, source, typeInfo, asmMetadataReaderParm, pdbMetadataReaderParm);
methods[entryRow] = methodInfo;
Expand All@@ -1018,13 +1018,13 @@ private void PopulateEnC(MetadataReader asmMetadataReaderParm, MetadataReader pd
}
}
}
private SourceFile GetOrAddSourceFile(DocumentHandle doc, int rowid, string documentName)
private SourceFile GetOrAddSourceFile(DocumentHandle doc, string documentName)
{
if (_documentIdToSourceFileTable.TryGetValue(rowid, out SourceFile source))
if (_documentIdToSourceFileTable.TryGetValue(documentName.GetHashCode(), out SourceFile source))
return source;

var src = new SourceFile(this, _documentIdToSourceFileTable.Count, doc, GetSourceLinkUrl(documentName), documentName);
_documentIdToSourceFileTable[rowid] = src;
_documentIdToSourceFileTable[documentName.GetHashCode()] = src;
return src;
}

Expand DownExpand Up@@ -1054,7 +1054,7 @@ private void Populate()
{
var document = pdbMetadataReader.GetDocument(methodDebugInformation.Document);
var documentName = pdbMetadataReader.GetString(document.Name);
source = GetOrAddSourceFile(methodDebugInformation.Document, asmMetadataReader.GetRowNumber(methodDebugInformation.Document), documentName);
source = GetOrAddSourceFile(methodDebugInformation.Document, documentName);
}
}
var methodInfo = new MethodInfo(this, method, asmMetadataReader.GetRowNumber(method), source, typeInfo, asmMetadataReader, pdbMetadataReader);
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -868,7 +868,7 @@ private async Task<bool> SendBreakpointsOfMethodUpdated(SessionId sessionId, Exe
{
var methodId = retDebuggerCmdReader.ReadInt32();
var method = await context.SdbAgent.GetMethodInfo(methodId, token);
if (method == null)
if (method == null || method.Info.Source is null)
{
return true;
}
Expand Down
15 changes: 10 additions & 5 deletions src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -1322,7 +1322,7 @@ internal async Task<JObject> LoadAssemblyDynamicallyALCAndRunMethod(string asm_f
return await WaitFor(Inspector.PAUSE);
}

internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(string asm_file, string pdb_file, string class_name, string method_name, bool expectBpResolvedEvent)
internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(string asm_file, string pdb_file, string class_name, string method_name, bool expectBpResolvedEvent, params string[] sourcesToWait)
{
byte[] bytes = File.ReadAllBytes(asm_file);
string asm_base64 = Convert.ToBase64String(bytes);
Expand All@@ -1338,7 +1338,7 @@ internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(

Task eventTask = expectBpResolvedEvent
? WaitForBreakpointResolvedEvent()
: WaitForScriptParsedEventsAsync("MethodBody0.cs", "MethodBody1.cs");
: WaitForScriptParsedEventsAsync(sourcesToWait);
(await cli.SendCommand("Runtime.evaluate", load_assemblies, token)).AssertOk();
await eventTask;

Expand DownExpand Up@@ -1397,7 +1397,7 @@ internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDB(string asm_fil
return await WaitFor(Inspector.PAUSE);
}

internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, string pdb_file, string asm_file_hot_reload, string class_name, string method_name, bool expectBpResolvedEvent)
internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, string pdb_file, string asm_file_hot_reload, string class_name, string method_name, bool expectBpResolvedEvent, string[] sourcesToWait, string methodName2 = "", string methodName3 = "")
{
byte[] bytes = File.ReadAllBytes(asm_file);
string asm_base64 = Convert.ToBase64String(bytes);
Expand DownExpand Up@@ -1434,13 +1434,18 @@ internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, strin

Task eventTask = expectBpResolvedEvent
? WaitForBreakpointResolvedEvent()
: WaitForScriptParsedEventsAsync("MethodBody0.cs", "MethodBody1.cs");
: WaitForScriptParsedEventsAsync(sourcesToWait);
(await cli.SendCommand("Runtime.evaluate", load_assemblies, token)).AssertOk();
await eventTask;

if (methodName2 == "")
methodName2 = method_name;
if (methodName3 == "")
methodName3 = method_name;

var run_method = JObject.FromObject(new
{
expression = "window.setTimeout(function() { invoke_static_method('[debugger-test] TestHotReload:RunMethod', '" + class_name + "', '" + method_name + "'); }, 1);"
expression = "window.setTimeout(function() { invoke_static_method('[debugger-test] TestHotReload:RunMethod', '" + class_name + "', '" + method_name + "', '" + methodName2 + "', '" + methodName3 + "'); }, 1);"
});

await cli.SendCommand("Runtime.evaluate", run_method, token);
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
[mono] Fix assertion while adding a new method using Hot Reload. by thaystg · Pull Request #75432 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 7 additions & 8 deletions src/mono/mono/component/hot_reload.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -2118,6 +2118,13 @@ apply_enclog_pass2 (Pass2Context *ctx, MonoImage *image_base, BaselineInfo *base
if (func_code == ENC_FUNC_ADD_PARAM)
break;

if (!base_info->method_table_update)
base_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_table_update)
delta_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_ppdb_table_update)
delta_info->method_ppdb_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);

if (is_addition) {
g_assertf (add_member_typedef, "EnC: new method added but I don't know the class, should be caught by pass1");
if (pass2_context_is_skeleton (ctx, add_member_typedef)) {
Expand All@@ -2139,14 +2146,6 @@ apply_enclog_pass2 (Pass2Context *ctx, MonoImage *image_base, BaselineInfo *base
add_member_typedef = 0;
}

if (!base_info->method_table_update)
base_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_table_update)
delta_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_ppdb_table_update)

delta_info->method_ppdb_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);

int mapped_token = hot_reload_relative_delta_index (image_dmeta, delta_info, mono_metadata_make_token (token_table, token_index));
guint32 rva = mono_metadata_decode_row_col (&image_dmeta->tables [MONO_TABLE_METHOD], mapped_token - 1, MONO_METHOD_RVA);
if (rva < dil_length) {
Expand Down
10 changes: 5 additions & 5 deletions src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -996,7 +996,7 @@ private void PopulateEnC(MetadataReader asmMetadataReaderParm, MetadataReader pd
{
var document = pdbMetadataReaderParm.GetDocument(methodDebugInformation.Document);
var documentName = pdbMetadataReaderParm.GetString(document.Name);
source = GetOrAddSourceFile(methodDebugInformation.Document, asmMetadataReaderParm.GetRowNumber(methodDebugInformation.Document), documentName);
source = GetOrAddSourceFile(methodDebugInformation.Document, documentName);
}
var methodInfo = new MethodInfo(this, MetadataTokens.MethodDefinitionHandle(methodIdxAsm), entryRow, source, typeInfo, asmMetadataReaderParm, pdbMetadataReaderParm);
methods[entryRow] = methodInfo;
Expand All@@ -1018,13 +1018,13 @@ private void PopulateEnC(MetadataReader asmMetadataReaderParm, MetadataReader pd
}
}
}
private SourceFile GetOrAddSourceFile(DocumentHandle doc, int rowid, string documentName)
private SourceFile GetOrAddSourceFile(DocumentHandle doc, string documentName)
{
if (_documentIdToSourceFileTable.TryGetValue(rowid, out SourceFile source))
if (_documentIdToSourceFileTable.TryGetValue(documentName.GetHashCode(), out SourceFile source))
return source;

var src = new SourceFile(this, _documentIdToSourceFileTable.Count, doc, GetSourceLinkUrl(documentName), documentName);
_documentIdToSourceFileTable[rowid] = src;
_documentIdToSourceFileTable[documentName.GetHashCode()] = src;
return src;
}

Expand DownExpand Up@@ -1054,7 +1054,7 @@ private void Populate()
{
var document = pdbMetadataReader.GetDocument(methodDebugInformation.Document);
var documentName = pdbMetadataReader.GetString(document.Name);
source = GetOrAddSourceFile(methodDebugInformation.Document, asmMetadataReader.GetRowNumber(methodDebugInformation.Document), documentName);
source = GetOrAddSourceFile(methodDebugInformation.Document, documentName);
}
}
var methodInfo = new MethodInfo(this, method, asmMetadataReader.GetRowNumber(method), source, typeInfo, asmMetadataReader, pdbMetadataReader);
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -868,7 +868,7 @@ private async Task<bool> SendBreakpointsOfMethodUpdated(SessionId sessionId, Exe
{
var methodId = retDebuggerCmdReader.ReadInt32();
var method = await context.SdbAgent.GetMethodInfo(methodId, token);
if (method == null)
if (method == null || method.Info.Source is null)
{
return true;
}
Expand Down
15 changes: 10 additions & 5 deletions src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -1322,7 +1322,7 @@ internal async Task<JObject> LoadAssemblyDynamicallyALCAndRunMethod(string asm_f
return await WaitFor(Inspector.PAUSE);
}

internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(string asm_file, string pdb_file, string class_name, string method_name, bool expectBpResolvedEvent)
internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(string asm_file, string pdb_file, string class_name, string method_name, bool expectBpResolvedEvent, params string[] sourcesToWait)
{
byte[] bytes = File.ReadAllBytes(asm_file);
string asm_base64 = Convert.ToBase64String(bytes);
Expand All@@ -1338,7 +1338,7 @@ internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(

Task eventTask = expectBpResolvedEvent
? WaitForBreakpointResolvedEvent()
: WaitForScriptParsedEventsAsync("MethodBody0.cs", "MethodBody1.cs");
: WaitForScriptParsedEventsAsync(sourcesToWait);
(await cli.SendCommand("Runtime.evaluate", load_assemblies, token)).AssertOk();
await eventTask;

Expand DownExpand Up@@ -1397,7 +1397,7 @@ internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDB(string asm_fil
return await WaitFor(Inspector.PAUSE);
}

internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, string pdb_file, string asm_file_hot_reload, string class_name, string method_name, bool expectBpResolvedEvent)
internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, string pdb_file, string asm_file_hot_reload, string class_name, string method_name, bool expectBpResolvedEvent, string[] sourcesToWait, string methodName2 = "", string methodName3 = "")
{
byte[] bytes = File.ReadAllBytes(asm_file);
string asm_base64 = Convert.ToBase64String(bytes);
Expand DownExpand Up@@ -1434,13 +1434,18 @@ internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, strin

Task eventTask = expectBpResolvedEvent
? WaitForBreakpointResolvedEvent()
: WaitForScriptParsedEventsAsync("MethodBody0.cs", "MethodBody1.cs");
: WaitForScriptParsedEventsAsync(sourcesToWait);
(await cli.SendCommand("Runtime.evaluate", load_assemblies, token)).AssertOk();
await eventTask;

if (methodName2 == "")
methodName2 = method_name;
if (methodName3 == "")
methodName3 = method_name;

var run_method = JObject.FromObject(new
{
expression = "window.setTimeout(function() { invoke_static_method('[debugger-test] TestHotReload:RunMethod', '" + class_name + "', '" + method_name + "'); }, 1);"
expression = "window.setTimeout(function() { invoke_static_method('[debugger-test] TestHotReload:RunMethod', '" + class_name + "', '" + method_name + "', '" + methodName2 + "', '" + methodName3 + "'); }, 1);"
});

await cli.SendCommand("Runtime.evaluate", run_method, token);
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [mono] Fix assertion while adding a new method using Hot Reload. by thaystg · Pull Request #75432 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 7 additions & 8 deletions src/mono/mono/component/hot_reload.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -2118,6 +2118,13 @@ apply_enclog_pass2 (Pass2Context *ctx, MonoImage *image_base, BaselineInfo *base
if (func_code == ENC_FUNC_ADD_PARAM)
break;

if (!base_info->method_table_update)
base_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_table_update)
delta_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_ppdb_table_update)
delta_info->method_ppdb_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);

if (is_addition) {
g_assertf (add_member_typedef, "EnC: new method added but I don't know the class, should be caught by pass1");
if (pass2_context_is_skeleton (ctx, add_member_typedef)) {
Expand All@@ -2139,14 +2146,6 @@ apply_enclog_pass2 (Pass2Context *ctx, MonoImage *image_base, BaselineInfo *base
add_member_typedef = 0;
}

if (!base_info->method_table_update)
base_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_table_update)
delta_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_ppdb_table_update)

delta_info->method_ppdb_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);

int mapped_token = hot_reload_relative_delta_index (image_dmeta, delta_info, mono_metadata_make_token (token_table, token_index));
guint32 rva = mono_metadata_decode_row_col (&image_dmeta->tables [MONO_TABLE_METHOD], mapped_token - 1, MONO_METHOD_RVA);
if (rva < dil_length) {
Expand Down
10 changes: 5 additions & 5 deletions src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -996,7 +996,7 @@ private void PopulateEnC(MetadataReader asmMetadataReaderParm, MetadataReader pd
{
var document = pdbMetadataReaderParm.GetDocument(methodDebugInformation.Document);
var documentName = pdbMetadataReaderParm.GetString(document.Name);
source = GetOrAddSourceFile(methodDebugInformation.Document, asmMetadataReaderParm.GetRowNumber(methodDebugInformation.Document), documentName);
source = GetOrAddSourceFile(methodDebugInformation.Document, documentName);
}
var methodInfo = new MethodInfo(this, MetadataTokens.MethodDefinitionHandle(methodIdxAsm), entryRow, source, typeInfo, asmMetadataReaderParm, pdbMetadataReaderParm);
methods[entryRow] = methodInfo;
Expand All@@ -1018,13 +1018,13 @@ private void PopulateEnC(MetadataReader asmMetadataReaderParm, MetadataReader pd
}
}
}
private SourceFile GetOrAddSourceFile(DocumentHandle doc, int rowid, string documentName)
private SourceFile GetOrAddSourceFile(DocumentHandle doc, string documentName)
{
if (_documentIdToSourceFileTable.TryGetValue(rowid, out SourceFile source))
if (_documentIdToSourceFileTable.TryGetValue(documentName.GetHashCode(), out SourceFile source))
return source;

var src = new SourceFile(this, _documentIdToSourceFileTable.Count, doc, GetSourceLinkUrl(documentName), documentName);
_documentIdToSourceFileTable[rowid] = src;
_documentIdToSourceFileTable[documentName.GetHashCode()] = src;
return src;
}

Expand DownExpand Up@@ -1054,7 +1054,7 @@ private void Populate()
{
var document = pdbMetadataReader.GetDocument(methodDebugInformation.Document);
var documentName = pdbMetadataReader.GetString(document.Name);
source = GetOrAddSourceFile(methodDebugInformation.Document, asmMetadataReader.GetRowNumber(methodDebugInformation.Document), documentName);
source = GetOrAddSourceFile(methodDebugInformation.Document, documentName);
}
}
var methodInfo = new MethodInfo(this, method, asmMetadataReader.GetRowNumber(method), source, typeInfo, asmMetadataReader, pdbMetadataReader);
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -868,7 +868,7 @@ private async Task<bool> SendBreakpointsOfMethodUpdated(SessionId sessionId, Exe
{
var methodId = retDebuggerCmdReader.ReadInt32();
var method = await context.SdbAgent.GetMethodInfo(methodId, token);
if (method == null)
if (method == null || method.Info.Source is null)
{
return true;
}
Expand Down
15 changes: 10 additions & 5 deletions src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -1322,7 +1322,7 @@ internal async Task<JObject> LoadAssemblyDynamicallyALCAndRunMethod(string asm_f
return await WaitFor(Inspector.PAUSE);
}

internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(string asm_file, string pdb_file, string class_name, string method_name, bool expectBpResolvedEvent)
internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(string asm_file, string pdb_file, string class_name, string method_name, bool expectBpResolvedEvent, params string[] sourcesToWait)
{
byte[] bytes = File.ReadAllBytes(asm_file);
string asm_base64 = Convert.ToBase64String(bytes);
Expand All@@ -1338,7 +1338,7 @@ internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(

Task eventTask = expectBpResolvedEvent
? WaitForBreakpointResolvedEvent()
: WaitForScriptParsedEventsAsync("MethodBody0.cs", "MethodBody1.cs");
: WaitForScriptParsedEventsAsync(sourcesToWait);
(await cli.SendCommand("Runtime.evaluate", load_assemblies, token)).AssertOk();
await eventTask;

Expand DownExpand Up@@ -1397,7 +1397,7 @@ internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDB(string asm_fil
return await WaitFor(Inspector.PAUSE);
}

internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, string pdb_file, string asm_file_hot_reload, string class_name, string method_name, bool expectBpResolvedEvent)
internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, string pdb_file, string asm_file_hot_reload, string class_name, string method_name, bool expectBpResolvedEvent, string[] sourcesToWait, string methodName2 = "", string methodName3 = "")
{
byte[] bytes = File.ReadAllBytes(asm_file);
string asm_base64 = Convert.ToBase64String(bytes);
Expand DownExpand Up@@ -1434,13 +1434,18 @@ internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, strin

Task eventTask = expectBpResolvedEvent
? WaitForBreakpointResolvedEvent()
: WaitForScriptParsedEventsAsync("MethodBody0.cs", "MethodBody1.cs");
: WaitForScriptParsedEventsAsync(sourcesToWait);
(await cli.SendCommand("Runtime.evaluate", load_assemblies, token)).AssertOk();
await eventTask;

if (methodName2 == "")
methodName2 = method_name;
if (methodName3 == "")
methodName3 = method_name;

var run_method = JObject.FromObject(new
{
expression = "window.setTimeout(function() { invoke_static_method('[debugger-test] TestHotReload:RunMethod', '" + class_name + "', '" + method_name + "'); }, 1);"
expression = "window.setTimeout(function() { invoke_static_method('[debugger-test] TestHotReload:RunMethod', '" + class_name + "', '" + method_name + "', '" + methodName2 + "', '" + methodName3 + "'); }, 1);"
});

await cli.SendCommand("Runtime.evaluate", run_method, token);
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [mono] Fix assertion while adding a new method using Hot Reload. by thaystg · Pull Request #75432 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 7 additions & 8 deletions src/mono/mono/component/hot_reload.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -2118,6 +2118,13 @@ apply_enclog_pass2 (Pass2Context *ctx, MonoImage *image_base, BaselineInfo *base
if (func_code == ENC_FUNC_ADD_PARAM)
break;

if (!base_info->method_table_update)
base_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_table_update)
delta_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_ppdb_table_update)
delta_info->method_ppdb_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);

if (is_addition) {
g_assertf (add_member_typedef, "EnC: new method added but I don't know the class, should be caught by pass1");
if (pass2_context_is_skeleton (ctx, add_member_typedef)) {
Expand All@@ -2139,14 +2146,6 @@ apply_enclog_pass2 (Pass2Context *ctx, MonoImage *image_base, BaselineInfo *base
add_member_typedef = 0;
}

if (!base_info->method_table_update)
base_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_table_update)
delta_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_ppdb_table_update)

delta_info->method_ppdb_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);

int mapped_token = hot_reload_relative_delta_index (image_dmeta, delta_info, mono_metadata_make_token (token_table, token_index));
guint32 rva = mono_metadata_decode_row_col (&image_dmeta->tables [MONO_TABLE_METHOD], mapped_token - 1, MONO_METHOD_RVA);
if (rva < dil_length) {
Expand Down
10 changes: 5 additions & 5 deletions src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -996,7 +996,7 @@ private void PopulateEnC(MetadataReader asmMetadataReaderParm, MetadataReader pd
{
var document = pdbMetadataReaderParm.GetDocument(methodDebugInformation.Document);
var documentName = pdbMetadataReaderParm.GetString(document.Name);
source = GetOrAddSourceFile(methodDebugInformation.Document, asmMetadataReaderParm.GetRowNumber(methodDebugInformation.Document), documentName);
source = GetOrAddSourceFile(methodDebugInformation.Document, documentName);
}
var methodInfo = new MethodInfo(this, MetadataTokens.MethodDefinitionHandle(methodIdxAsm), entryRow, source, typeInfo, asmMetadataReaderParm, pdbMetadataReaderParm);
methods[entryRow] = methodInfo;
Expand All@@ -1018,13 +1018,13 @@ private void PopulateEnC(MetadataReader asmMetadataReaderParm, MetadataReader pd
}
}
}
private SourceFile GetOrAddSourceFile(DocumentHandle doc, int rowid, string documentName)
private SourceFile GetOrAddSourceFile(DocumentHandle doc, string documentName)
{
if (_documentIdToSourceFileTable.TryGetValue(rowid, out SourceFile source))
if (_documentIdToSourceFileTable.TryGetValue(documentName.GetHashCode(), out SourceFile source))
return source;

var src = new SourceFile(this, _documentIdToSourceFileTable.Count, doc, GetSourceLinkUrl(documentName), documentName);
_documentIdToSourceFileTable[rowid] = src;
_documentIdToSourceFileTable[documentName.GetHashCode()] = src;
return src;
}

Expand DownExpand Up@@ -1054,7 +1054,7 @@ private void Populate()
{
var document = pdbMetadataReader.GetDocument(methodDebugInformation.Document);
var documentName = pdbMetadataReader.GetString(document.Name);
source = GetOrAddSourceFile(methodDebugInformation.Document, asmMetadataReader.GetRowNumber(methodDebugInformation.Document), documentName);
source = GetOrAddSourceFile(methodDebugInformation.Document, documentName);
}
}
var methodInfo = new MethodInfo(this, method, asmMetadataReader.GetRowNumber(method), source, typeInfo, asmMetadataReader, pdbMetadataReader);
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -868,7 +868,7 @@ private async Task<bool> SendBreakpointsOfMethodUpdated(SessionId sessionId, Exe
{
var methodId = retDebuggerCmdReader.ReadInt32();
var method = await context.SdbAgent.GetMethodInfo(methodId, token);
if (method == null)
if (method == null || method.Info.Source is null)
{
return true;
}
Expand Down
15 changes: 10 additions & 5 deletions src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -1322,7 +1322,7 @@ internal async Task<JObject> LoadAssemblyDynamicallyALCAndRunMethod(string asm_f
return await WaitFor(Inspector.PAUSE);
}

internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(string asm_file, string pdb_file, string class_name, string method_name, bool expectBpResolvedEvent)
internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(string asm_file, string pdb_file, string class_name, string method_name, bool expectBpResolvedEvent, params string[] sourcesToWait)
{
byte[] bytes = File.ReadAllBytes(asm_file);
string asm_base64 = Convert.ToBase64String(bytes);
Expand All@@ -1338,7 +1338,7 @@ internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(

Task eventTask = expectBpResolvedEvent
? WaitForBreakpointResolvedEvent()
: WaitForScriptParsedEventsAsync("MethodBody0.cs", "MethodBody1.cs");
: WaitForScriptParsedEventsAsync(sourcesToWait);
(await cli.SendCommand("Runtime.evaluate", load_assemblies, token)).AssertOk();
await eventTask;

Expand DownExpand Up@@ -1397,7 +1397,7 @@ internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDB(string asm_fil
return await WaitFor(Inspector.PAUSE);
}

internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, string pdb_file, string asm_file_hot_reload, string class_name, string method_name, bool expectBpResolvedEvent)
internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, string pdb_file, string asm_file_hot_reload, string class_name, string method_name, bool expectBpResolvedEvent, string[] sourcesToWait, string methodName2 = "", string methodName3 = "")
{
byte[] bytes = File.ReadAllBytes(asm_file);
string asm_base64 = Convert.ToBase64String(bytes);
Expand DownExpand Up@@ -1434,13 +1434,18 @@ internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, strin

Task eventTask = expectBpResolvedEvent
? WaitForBreakpointResolvedEvent()
: WaitForScriptParsedEventsAsync("MethodBody0.cs", "MethodBody1.cs");
: WaitForScriptParsedEventsAsync(sourcesToWait);
(await cli.SendCommand("Runtime.evaluate", load_assemblies, token)).AssertOk();
await eventTask;

if (methodName2 == "")
methodName2 = method_name;
if (methodName3 == "")
methodName3 = method_name;

var run_method = JObject.FromObject(new
{
expression = "window.setTimeout(function() { invoke_static_method('[debugger-test] TestHotReload:RunMethod', '" + class_name + "', '" + method_name + "'); }, 1);"
expression = "window.setTimeout(function() { invoke_static_method('[debugger-test] TestHotReload:RunMethod', '" + class_name + "', '" + method_name + "', '" + methodName2 + "', '" + methodName3 + "'); }, 1);"
});

await cli.SendCommand("Runtime.evaluate", run_method, token);
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' [mono] Fix assertion while adding a new method using Hot Reload. by thaystg · Pull Request #75432 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 7 additions & 8 deletions src/mono/mono/component/hot_reload.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -2118,6 +2118,13 @@ apply_enclog_pass2 (Pass2Context *ctx, MonoImage *image_base, BaselineInfo *base
if (func_code == ENC_FUNC_ADD_PARAM)
break;

if (!base_info->method_table_update)
base_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_table_update)
delta_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_ppdb_table_update)
delta_info->method_ppdb_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);

if (is_addition) {
g_assertf (add_member_typedef, "EnC: new method added but I don't know the class, should be caught by pass1");
if (pass2_context_is_skeleton (ctx, add_member_typedef)) {
Expand All@@ -2139,14 +2146,6 @@ apply_enclog_pass2 (Pass2Context *ctx, MonoImage *image_base, BaselineInfo *base
add_member_typedef = 0;
}

if (!base_info->method_table_update)
base_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_table_update)
delta_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_ppdb_table_update)

delta_info->method_ppdb_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);

int mapped_token = hot_reload_relative_delta_index (image_dmeta, delta_info, mono_metadata_make_token (token_table, token_index));
guint32 rva = mono_metadata_decode_row_col (&image_dmeta->tables [MONO_TABLE_METHOD], mapped_token - 1, MONO_METHOD_RVA);
if (rva < dil_length) {
Expand Down
10 changes: 5 additions & 5 deletions src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -996,7 +996,7 @@ private void PopulateEnC(MetadataReader asmMetadataReaderParm, MetadataReader pd
{
var document = pdbMetadataReaderParm.GetDocument(methodDebugInformation.Document);
var documentName = pdbMetadataReaderParm.GetString(document.Name);
source = GetOrAddSourceFile(methodDebugInformation.Document, asmMetadataReaderParm.GetRowNumber(methodDebugInformation.Document), documentName);
source = GetOrAddSourceFile(methodDebugInformation.Document, documentName);
}
var methodInfo = new MethodInfo(this, MetadataTokens.MethodDefinitionHandle(methodIdxAsm), entryRow, source, typeInfo, asmMetadataReaderParm, pdbMetadataReaderParm);
methods[entryRow] = methodInfo;
Expand All@@ -1018,13 +1018,13 @@ private void PopulateEnC(MetadataReader asmMetadataReaderParm, MetadataReader pd
}
}
}
private SourceFile GetOrAddSourceFile(DocumentHandle doc, int rowid, string documentName)
private SourceFile GetOrAddSourceFile(DocumentHandle doc, string documentName)
{
if (_documentIdToSourceFileTable.TryGetValue(rowid, out SourceFile source))
if (_documentIdToSourceFileTable.TryGetValue(documentName.GetHashCode(), out SourceFile source))
return source;

var src = new SourceFile(this, _documentIdToSourceFileTable.Count, doc, GetSourceLinkUrl(documentName), documentName);
_documentIdToSourceFileTable[rowid] = src;
_documentIdToSourceFileTable[documentName.GetHashCode()] = src;
return src;
}

Expand DownExpand Up@@ -1054,7 +1054,7 @@ private void Populate()
{
var document = pdbMetadataReader.GetDocument(methodDebugInformation.Document);
var documentName = pdbMetadataReader.GetString(document.Name);
source = GetOrAddSourceFile(methodDebugInformation.Document, asmMetadataReader.GetRowNumber(methodDebugInformation.Document), documentName);
source = GetOrAddSourceFile(methodDebugInformation.Document, documentName);
}
}
var methodInfo = new MethodInfo(this, method, asmMetadataReader.GetRowNumber(method), source, typeInfo, asmMetadataReader, pdbMetadataReader);
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -868,7 +868,7 @@ private async Task<bool> SendBreakpointsOfMethodUpdated(SessionId sessionId, Exe
{
var methodId = retDebuggerCmdReader.ReadInt32();
var method = await context.SdbAgent.GetMethodInfo(methodId, token);
if (method == null)
if (method == null || method.Info.Source is null)
{
return true;
}
Expand Down
15 changes: 10 additions & 5 deletions src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -1322,7 +1322,7 @@ internal async Task<JObject> LoadAssemblyDynamicallyALCAndRunMethod(string asm_f
return await WaitFor(Inspector.PAUSE);
}

internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(string asm_file, string pdb_file, string class_name, string method_name, bool expectBpResolvedEvent)
internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(string asm_file, string pdb_file, string class_name, string method_name, bool expectBpResolvedEvent, params string[] sourcesToWait)
{
byte[] bytes = File.ReadAllBytes(asm_file);
string asm_base64 = Convert.ToBase64String(bytes);
Expand All@@ -1338,7 +1338,7 @@ internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(

Task eventTask = expectBpResolvedEvent
? WaitForBreakpointResolvedEvent()
: WaitForScriptParsedEventsAsync("MethodBody0.cs", "MethodBody1.cs");
: WaitForScriptParsedEventsAsync(sourcesToWait);
(await cli.SendCommand("Runtime.evaluate", load_assemblies, token)).AssertOk();
await eventTask;

Expand DownExpand Up@@ -1397,7 +1397,7 @@ internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDB(string asm_fil
return await WaitFor(Inspector.PAUSE);
}

internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, string pdb_file, string asm_file_hot_reload, string class_name, string method_name, bool expectBpResolvedEvent)
internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, string pdb_file, string asm_file_hot_reload, string class_name, string method_name, bool expectBpResolvedEvent, string[] sourcesToWait, string methodName2 = "", string methodName3 = "")
{
byte[] bytes = File.ReadAllBytes(asm_file);
string asm_base64 = Convert.ToBase64String(bytes);
Expand DownExpand Up@@ -1434,13 +1434,18 @@ internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, strin

Task eventTask = expectBpResolvedEvent
? WaitForBreakpointResolvedEvent()
: WaitForScriptParsedEventsAsync("MethodBody0.cs", "MethodBody1.cs");
: WaitForScriptParsedEventsAsync(sourcesToWait);
(await cli.SendCommand("Runtime.evaluate", load_assemblies, token)).AssertOk();
await eventTask;

if (methodName2 == "")
methodName2 = method_name;
if (methodName3 == "")
methodName3 = method_name;

var run_method = JObject.FromObject(new
{
expression = "window.setTimeout(function() { invoke_static_method('[debugger-test] TestHotReload:RunMethod', '" + class_name + "', '" + method_name + "'); }, 1);"
expression = "window.setTimeout(function() { invoke_static_method('[debugger-test] TestHotReload:RunMethod', '" + class_name + "', '" + method_name + "', '" + methodName2 + "', '" + methodName3 + "'); }, 1);"
});

await cli.SendCommand("Runtime.evaluate", run_method, token);
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [mono] Fix assertion while adding a new method using Hot Reload. by thaystg · Pull Request #75432 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 7 additions & 8 deletions src/mono/mono/component/hot_reload.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -2118,6 +2118,13 @@ apply_enclog_pass2 (Pass2Context *ctx, MonoImage *image_base, BaselineInfo *base
if (func_code == ENC_FUNC_ADD_PARAM)
break;

if (!base_info->method_table_update)
base_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_table_update)
delta_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_ppdb_table_update)
delta_info->method_ppdb_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);

if (is_addition) {
g_assertf (add_member_typedef, "EnC: new method added but I don't know the class, should be caught by pass1");
if (pass2_context_is_skeleton (ctx, add_member_typedef)) {
Expand All@@ -2139,14 +2146,6 @@ apply_enclog_pass2 (Pass2Context *ctx, MonoImage *image_base, BaselineInfo *base
add_member_typedef = 0;
}

if (!base_info->method_table_update)
base_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_table_update)
delta_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_ppdb_table_update)

delta_info->method_ppdb_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);

int mapped_token = hot_reload_relative_delta_index (image_dmeta, delta_info, mono_metadata_make_token (token_table, token_index));
guint32 rva = mono_metadata_decode_row_col (&image_dmeta->tables [MONO_TABLE_METHOD], mapped_token - 1, MONO_METHOD_RVA);
if (rva < dil_length) {
Expand Down
10 changes: 5 additions & 5 deletions src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -996,7 +996,7 @@ private void PopulateEnC(MetadataReader asmMetadataReaderParm, MetadataReader pd
{
var document = pdbMetadataReaderParm.GetDocument(methodDebugInformation.Document);
var documentName = pdbMetadataReaderParm.GetString(document.Name);
source = GetOrAddSourceFile(methodDebugInformation.Document, asmMetadataReaderParm.GetRowNumber(methodDebugInformation.Document), documentName);
source = GetOrAddSourceFile(methodDebugInformation.Document, documentName);
}
var methodInfo = new MethodInfo(this, MetadataTokens.MethodDefinitionHandle(methodIdxAsm), entryRow, source, typeInfo, asmMetadataReaderParm, pdbMetadataReaderParm);
methods[entryRow] = methodInfo;
Expand All@@ -1018,13 +1018,13 @@ private void PopulateEnC(MetadataReader asmMetadataReaderParm, MetadataReader pd
}
}
}
private SourceFile GetOrAddSourceFile(DocumentHandle doc, int rowid, string documentName)
private SourceFile GetOrAddSourceFile(DocumentHandle doc, string documentName)
{
if (_documentIdToSourceFileTable.TryGetValue(rowid, out SourceFile source))
if (_documentIdToSourceFileTable.TryGetValue(documentName.GetHashCode(), out SourceFile source))
return source;

var src = new SourceFile(this, _documentIdToSourceFileTable.Count, doc, GetSourceLinkUrl(documentName), documentName);
_documentIdToSourceFileTable[rowid] = src;
_documentIdToSourceFileTable[documentName.GetHashCode()] = src;
return src;
}

Expand DownExpand Up@@ -1054,7 +1054,7 @@ private void Populate()
{
var document = pdbMetadataReader.GetDocument(methodDebugInformation.Document);
var documentName = pdbMetadataReader.GetString(document.Name);
source = GetOrAddSourceFile(methodDebugInformation.Document, asmMetadataReader.GetRowNumber(methodDebugInformation.Document), documentName);
source = GetOrAddSourceFile(methodDebugInformation.Document, documentName);
}
}
var methodInfo = new MethodInfo(this, method, asmMetadataReader.GetRowNumber(method), source, typeInfo, asmMetadataReader, pdbMetadataReader);
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -868,7 +868,7 @@ private async Task<bool> SendBreakpointsOfMethodUpdated(SessionId sessionId, Exe
{
var methodId = retDebuggerCmdReader.ReadInt32();
var method = await context.SdbAgent.GetMethodInfo(methodId, token);
if (method == null)
if (method == null || method.Info.Source is null)
{
return true;
}
Expand Down
15 changes: 10 additions & 5 deletions src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -1322,7 +1322,7 @@ internal async Task<JObject> LoadAssemblyDynamicallyALCAndRunMethod(string asm_f
return await WaitFor(Inspector.PAUSE);
}

internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(string asm_file, string pdb_file, string class_name, string method_name, bool expectBpResolvedEvent)
internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(string asm_file, string pdb_file, string class_name, string method_name, bool expectBpResolvedEvent, params string[] sourcesToWait)
{
byte[] bytes = File.ReadAllBytes(asm_file);
string asm_base64 = Convert.ToBase64String(bytes);
Expand All@@ -1338,7 +1338,7 @@ internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(

Task eventTask = expectBpResolvedEvent
? WaitForBreakpointResolvedEvent()
: WaitForScriptParsedEventsAsync("MethodBody0.cs", "MethodBody1.cs");
: WaitForScriptParsedEventsAsync(sourcesToWait);
(await cli.SendCommand("Runtime.evaluate", load_assemblies, token)).AssertOk();
await eventTask;

Expand DownExpand Up@@ -1397,7 +1397,7 @@ internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDB(string asm_fil
return await WaitFor(Inspector.PAUSE);
}

internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, string pdb_file, string asm_file_hot_reload, string class_name, string method_name, bool expectBpResolvedEvent)
internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, string pdb_file, string asm_file_hot_reload, string class_name, string method_name, bool expectBpResolvedEvent, string[] sourcesToWait, string methodName2 = "", string methodName3 = "")
{
byte[] bytes = File.ReadAllBytes(asm_file);
string asm_base64 = Convert.ToBase64String(bytes);
Expand DownExpand Up@@ -1434,13 +1434,18 @@ internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, strin

Task eventTask = expectBpResolvedEvent
? WaitForBreakpointResolvedEvent()
: WaitForScriptParsedEventsAsync("MethodBody0.cs", "MethodBody1.cs");
: WaitForScriptParsedEventsAsync(sourcesToWait);
(await cli.SendCommand("Runtime.evaluate", load_assemblies, token)).AssertOk();
await eventTask;

if (methodName2 == "")
methodName2 = method_name;
if (methodName3 == "")
methodName3 = method_name;

var run_method = JObject.FromObject(new
{
expression = "window.setTimeout(function() { invoke_static_method('[debugger-test] TestHotReload:RunMethod', '" + class_name + "', '" + method_name + "'); }, 1);"
expression = "window.setTimeout(function() { invoke_static_method('[debugger-test] TestHotReload:RunMethod', '" + class_name + "', '" + method_name + "', '" + methodName2 + "', '" + methodName3 + "'); }, 1);"
});

await cli.SendCommand("Runtime.evaluate", run_method, token);
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' [mono] Fix assertion while adding a new method using Hot Reload. by thaystg · Pull Request #75432 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 7 additions & 8 deletions src/mono/mono/component/hot_reload.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -2118,6 +2118,13 @@ apply_enclog_pass2 (Pass2Context *ctx, MonoImage *image_base, BaselineInfo *base
if (func_code == ENC_FUNC_ADD_PARAM)
break;

if (!base_info->method_table_update)
base_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_table_update)
delta_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_ppdb_table_update)
delta_info->method_ppdb_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);

if (is_addition) {
g_assertf (add_member_typedef, "EnC: new method added but I don't know the class, should be caught by pass1");
if (pass2_context_is_skeleton (ctx, add_member_typedef)) {
Expand All@@ -2139,14 +2146,6 @@ apply_enclog_pass2 (Pass2Context *ctx, MonoImage *image_base, BaselineInfo *base
add_member_typedef = 0;
}

if (!base_info->method_table_update)
base_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_table_update)
delta_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_ppdb_table_update)

delta_info->method_ppdb_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);

int mapped_token = hot_reload_relative_delta_index (image_dmeta, delta_info, mono_metadata_make_token (token_table, token_index));
guint32 rva = mono_metadata_decode_row_col (&image_dmeta->tables [MONO_TABLE_METHOD], mapped_token - 1, MONO_METHOD_RVA);
if (rva < dil_length) {
Expand Down
10 changes: 5 additions & 5 deletions src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -996,7 +996,7 @@ private void PopulateEnC(MetadataReader asmMetadataReaderParm, MetadataReader pd
{
var document = pdbMetadataReaderParm.GetDocument(methodDebugInformation.Document);
var documentName = pdbMetadataReaderParm.GetString(document.Name);
source = GetOrAddSourceFile(methodDebugInformation.Document, asmMetadataReaderParm.GetRowNumber(methodDebugInformation.Document), documentName);
source = GetOrAddSourceFile(methodDebugInformation.Document, documentName);
}
var methodInfo = new MethodInfo(this, MetadataTokens.MethodDefinitionHandle(methodIdxAsm), entryRow, source, typeInfo, asmMetadataReaderParm, pdbMetadataReaderParm);
methods[entryRow] = methodInfo;
Expand All@@ -1018,13 +1018,13 @@ private void PopulateEnC(MetadataReader asmMetadataReaderParm, MetadataReader pd
}
}
}
private SourceFile GetOrAddSourceFile(DocumentHandle doc, int rowid, string documentName)
private SourceFile GetOrAddSourceFile(DocumentHandle doc, string documentName)
{
if (_documentIdToSourceFileTable.TryGetValue(rowid, out SourceFile source))
if (_documentIdToSourceFileTable.TryGetValue(documentName.GetHashCode(), out SourceFile source))
return source;

var src = new SourceFile(this, _documentIdToSourceFileTable.Count, doc, GetSourceLinkUrl(documentName), documentName);
_documentIdToSourceFileTable[rowid] = src;
_documentIdToSourceFileTable[documentName.GetHashCode()] = src;
return src;
}

Expand DownExpand Up@@ -1054,7 +1054,7 @@ private void Populate()
{
var document = pdbMetadataReader.GetDocument(methodDebugInformation.Document);
var documentName = pdbMetadataReader.GetString(document.Name);
source = GetOrAddSourceFile(methodDebugInformation.Document, asmMetadataReader.GetRowNumber(methodDebugInformation.Document), documentName);
source = GetOrAddSourceFile(methodDebugInformation.Document, documentName);
}
}
var methodInfo = new MethodInfo(this, method, asmMetadataReader.GetRowNumber(method), source, typeInfo, asmMetadataReader, pdbMetadataReader);
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -868,7 +868,7 @@ private async Task<bool> SendBreakpointsOfMethodUpdated(SessionId sessionId, Exe
{
var methodId = retDebuggerCmdReader.ReadInt32();
var method = await context.SdbAgent.GetMethodInfo(methodId, token);
if (method == null)
if (method == null || method.Info.Source is null)
{
return true;
}
Expand Down
15 changes: 10 additions & 5 deletions src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -1322,7 +1322,7 @@ internal async Task<JObject> LoadAssemblyDynamicallyALCAndRunMethod(string asm_f
return await WaitFor(Inspector.PAUSE);
}

internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(string asm_file, string pdb_file, string class_name, string method_name, bool expectBpResolvedEvent)
internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(string asm_file, string pdb_file, string class_name, string method_name, bool expectBpResolvedEvent, params string[] sourcesToWait)
{
byte[] bytes = File.ReadAllBytes(asm_file);
string asm_base64 = Convert.ToBase64String(bytes);
Expand All@@ -1338,7 +1338,7 @@ internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(

Task eventTask = expectBpResolvedEvent
? WaitForBreakpointResolvedEvent()
: WaitForScriptParsedEventsAsync("MethodBody0.cs", "MethodBody1.cs");
: WaitForScriptParsedEventsAsync(sourcesToWait);
(await cli.SendCommand("Runtime.evaluate", load_assemblies, token)).AssertOk();
await eventTask;

Expand DownExpand Up@@ -1397,7 +1397,7 @@ internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDB(string asm_fil
return await WaitFor(Inspector.PAUSE);
}

internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, string pdb_file, string asm_file_hot_reload, string class_name, string method_name, bool expectBpResolvedEvent)
internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, string pdb_file, string asm_file_hot_reload, string class_name, string method_name, bool expectBpResolvedEvent, string[] sourcesToWait, string methodName2 = "", string methodName3 = "")
{
byte[] bytes = File.ReadAllBytes(asm_file);
string asm_base64 = Convert.ToBase64String(bytes);
Expand DownExpand Up@@ -1434,13 +1434,18 @@ internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, strin

Task eventTask = expectBpResolvedEvent
? WaitForBreakpointResolvedEvent()
: WaitForScriptParsedEventsAsync("MethodBody0.cs", "MethodBody1.cs");
: WaitForScriptParsedEventsAsync(sourcesToWait);
(await cli.SendCommand("Runtime.evaluate", load_assemblies, token)).AssertOk();
await eventTask;

if (methodName2 == "")
methodName2 = method_name;
if (methodName3 == "")
methodName3 = method_name;

var run_method = JObject.FromObject(new
{
expression = "window.setTimeout(function() { invoke_static_method('[debugger-test] TestHotReload:RunMethod', '" + class_name + "', '" + method_name + "'); }, 1);"
expression = "window.setTimeout(function() { invoke_static_method('[debugger-test] TestHotReload:RunMethod', '" + class_name + "', '" + method_name + "', '" + methodName2 + "', '" + methodName3 + "'); }, 1);"
});

await cli.SendCommand("Runtime.evaluate", run_method, token);
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); [mono] Fix assertion while adding a new method using Hot Reload. by thaystg · Pull Request #75432 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 7 additions & 8 deletions src/mono/mono/component/hot_reload.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -2118,6 +2118,13 @@ apply_enclog_pass2 (Pass2Context *ctx, MonoImage *image_base, BaselineInfo *base
if (func_code == ENC_FUNC_ADD_PARAM)
break;

if (!base_info->method_table_update)
base_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_table_update)
delta_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_ppdb_table_update)
delta_info->method_ppdb_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);

if (is_addition) {
g_assertf (add_member_typedef, "EnC: new method added but I don't know the class, should be caught by pass1");
if (pass2_context_is_skeleton (ctx, add_member_typedef)) {
Expand All@@ -2139,14 +2146,6 @@ apply_enclog_pass2 (Pass2Context *ctx, MonoImage *image_base, BaselineInfo *base
add_member_typedef = 0;
}

if (!base_info->method_table_update)
base_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_table_update)
delta_info->method_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);
if (!delta_info->method_ppdb_table_update)

delta_info->method_ppdb_table_update = g_hash_table_new (g_direct_hash, g_direct_equal);

int mapped_token = hot_reload_relative_delta_index (image_dmeta, delta_info, mono_metadata_make_token (token_table, token_index));
guint32 rva = mono_metadata_decode_row_col (&image_dmeta->tables [MONO_TABLE_METHOD], mapped_token - 1, MONO_METHOD_RVA);
if (rva < dil_length) {
Expand Down
10 changes: 5 additions & 5 deletions src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -996,7 +996,7 @@ private void PopulateEnC(MetadataReader asmMetadataReaderParm, MetadataReader pd
{
var document = pdbMetadataReaderParm.GetDocument(methodDebugInformation.Document);
var documentName = pdbMetadataReaderParm.GetString(document.Name);
source = GetOrAddSourceFile(methodDebugInformation.Document, asmMetadataReaderParm.GetRowNumber(methodDebugInformation.Document), documentName);
source = GetOrAddSourceFile(methodDebugInformation.Document, documentName);
}
var methodInfo = new MethodInfo(this, MetadataTokens.MethodDefinitionHandle(methodIdxAsm), entryRow, source, typeInfo, asmMetadataReaderParm, pdbMetadataReaderParm);
methods[entryRow] = methodInfo;
Expand All@@ -1018,13 +1018,13 @@ private void PopulateEnC(MetadataReader asmMetadataReaderParm, MetadataReader pd
}
}
}
private SourceFile GetOrAddSourceFile(DocumentHandle doc, int rowid, string documentName)
private SourceFile GetOrAddSourceFile(DocumentHandle doc, string documentName)
{
if (_documentIdToSourceFileTable.TryGetValue(rowid, out SourceFile source))
if (_documentIdToSourceFileTable.TryGetValue(documentName.GetHashCode(), out SourceFile source))
return source;

var src = new SourceFile(this, _documentIdToSourceFileTable.Count, doc, GetSourceLinkUrl(documentName), documentName);
_documentIdToSourceFileTable[rowid] = src;
_documentIdToSourceFileTable[documentName.GetHashCode()] = src;
return src;
}

Expand DownExpand Up@@ -1054,7 +1054,7 @@ private void Populate()
{
var document = pdbMetadataReader.GetDocument(methodDebugInformation.Document);
var documentName = pdbMetadataReader.GetString(document.Name);
source = GetOrAddSourceFile(methodDebugInformation.Document, asmMetadataReader.GetRowNumber(methodDebugInformation.Document), documentName);
source = GetOrAddSourceFile(methodDebugInformation.Document, documentName);
}
}
var methodInfo = new MethodInfo(this, method, asmMetadataReader.GetRowNumber(method), source, typeInfo, asmMetadataReader, pdbMetadataReader);
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -868,7 +868,7 @@ private async Task<bool> SendBreakpointsOfMethodUpdated(SessionId sessionId, Exe
{
var methodId = retDebuggerCmdReader.ReadInt32();
var method = await context.SdbAgent.GetMethodInfo(methodId, token);
if (method == null)
if (method == null || method.Info.Source is null)
{
return true;
}
Expand Down
15 changes: 10 additions & 5 deletions src/mono/wasm/debugger/DebuggerTestSuite/DebuggerTestBase.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -1322,7 +1322,7 @@ internal async Task<JObject> LoadAssemblyDynamicallyALCAndRunMethod(string asm_f
return await WaitFor(Inspector.PAUSE);
}

internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(string asm_file, string pdb_file, string class_name, string method_name, bool expectBpResolvedEvent)
internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(string asm_file, string pdb_file, string class_name, string method_name, bool expectBpResolvedEvent, params string[] sourcesToWait)
{
byte[] bytes = File.ReadAllBytes(asm_file);
string asm_base64 = Convert.ToBase64String(bytes);
Expand All@@ -1338,7 +1338,7 @@ internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDBWithoutChanges(

Task eventTask = expectBpResolvedEvent
? WaitForBreakpointResolvedEvent()
: WaitForScriptParsedEventsAsync("MethodBody0.cs", "MethodBody1.cs");
: WaitForScriptParsedEventsAsync(sourcesToWait);
(await cli.SendCommand("Runtime.evaluate", load_assemblies, token)).AssertOk();
await eventTask;

Expand DownExpand Up@@ -1397,7 +1397,7 @@ internal async Task<JObject> LoadAssemblyAndTestHotReloadUsingSDB(string asm_fil
return await WaitFor(Inspector.PAUSE);
}

internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, string pdb_file, string asm_file_hot_reload, string class_name, string method_name, bool expectBpResolvedEvent)
internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, string pdb_file, string asm_file_hot_reload, string class_name, string method_name, bool expectBpResolvedEvent, string[] sourcesToWait, string methodName2 = "", string methodName3 = "")
{
byte[] bytes = File.ReadAllBytes(asm_file);
string asm_base64 = Convert.ToBase64String(bytes);
Expand DownExpand Up@@ -1434,13 +1434,18 @@ internal async Task<JObject> LoadAssemblyAndTestHotReload(string asm_file, strin

Task eventTask = expectBpResolvedEvent
? WaitForBreakpointResolvedEvent()
: WaitForScriptParsedEventsAsync("MethodBody0.cs", "MethodBody1.cs");
: WaitForScriptParsedEventsAsync(sourcesToWait);
(await cli.SendCommand("Runtime.evaluate", load_assemblies, token)).AssertOk();
await eventTask;

if (methodName2 == "")
methodName2 = method_name;
if (methodName3 == "")
methodName3 = method_name;

var run_method = JObject.FromObject(new
{
expression = "window.setTimeout(function() { invoke_static_method('[debugger-test] TestHotReload:RunMethod', '" + class_name + "', '" + method_name + "'); }, 1);"
expression = "window.setTimeout(function() { invoke_static_method('[debugger-test] TestHotReload:RunMethod', '" + class_name + "', '" + method_name + "', '" + methodName2 + "', '" + methodName3 + "'); }, 1);"
});

await cli.SendCommand("Runtime.evaluate", run_method, token);
Expand Down
Loading