-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[wasm][debugger] Fixing "Frame not in module" after vscode-js-debug changes #87979
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -515,14 +515,22 @@ public ExecutionContext GetCurrentContext(SessionId sessionId) | |
| ? context | ||
| : throw new KeyNotFoundException($"No execution context found for session {sessionId}"); | ||
|
|
||
| public bool TryGetCurrentExecutionContextValue(SessionId id, out ExecutionContext executionContext) | ||
| public bool TryGetCurrentExecutionContextValue(SessionId id, out ExecutionContext executionContext, bool ignoreDestroyedContext = true) | ||
| { | ||
| executionContext = null; | ||
| if (!contexts.TryGetValue(id, out ConcurrentBag<ExecutionContext> contextBag)) | ||
| return false; | ||
| if (contextBag.IsEmpty) | ||
| return false; | ||
| executionContext = contextBag.Where(context => context.Id == contextBag.Where(context => context.Destroyed == false).Max(context => context.Id)).FirstOrDefault(); | ||
| IEnumerable<ExecutionContext> validContexts = null; | ||
| if (ignoreDestroyedContext) | ||
| validContexts = contextBag.Where(context => context.Destroyed == false); | ||
| else | ||
| validContexts = contextBag; | ||
| if (!validContexts.Any()) | ||
| return false; | ||
| int maxId = validContexts.Max(context => context.Id); | ||
| executionContext = contextBag.Where(context => context.Id == maxId).FirstOrDefault(); | ||
| return executionContext != null; | ||
| } | ||
|
|
||
|
|
@@ -540,7 +548,7 @@ public void OnDefaultContextUpdate(SessionId sessionId, ExecutionContext newCont | |
|
|
||
| public bool TryGetAndAddContext(SessionId sessionId, ExecutionContext newExecutionContext, out ExecutionContext previousExecutionContext) | ||
| { | ||
| bool hasExisting = TryGetCurrentExecutionContextValue(sessionId, out previousExecutionContext); | ||
| bool hasExisting = TryGetCurrentExecutionContextValue(sessionId, out previousExecutionContext, false); | ||
radical marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ConcurrentBag<ExecutionContext> bag = contexts.GetOrAdd(sessionId, _ => new ConcurrentBag<ExecutionContext>()); | ||
| bag.Add(newExecutionContext); | ||
| return hasExisting; | ||
|
|
@@ -569,6 +577,13 @@ public void DestroyContext(SessionId sessionId, int id) | |
| foreach (ExecutionContext context in contextBag.Where(x => x.Id == id).ToList()) | ||
| context.Destroyed = true; | ||
| } | ||
| public void ClearContexts(SessionId sessionId) | ||
| { | ||
| if (!contexts.TryGetValue(sessionId, out ConcurrentBag<ExecutionContext> contextBag)) | ||
| return; | ||
| foreach (ExecutionContext context in contextBag) | ||
| context.Destroyed = true; | ||
|
Comment on lines
+584
to
+585
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll probably be looking at this stuff more with the mt+debugging, but it's fine for now. |
||
| } | ||
| public bool ContainsKey(SessionId sessionId) => contexts.ContainsKey(sessionId); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -142,6 +142,11 @@ protected override async Task<bool> AcceptEvent(SessionId sessionId, JObject par | |
| Contexts.DestroyContext(sessionId, args["executionContextId"].Value<int>()); | ||
| return false; | ||
| } | ||
| case "Runtime.executionContextsCleared": | ||
| { | ||
| Contexts.ClearContexts(sessionId); | ||
| return false; | ||
| } | ||
|
|
||
| case "Debugger.paused": | ||
| { | ||
|
|
@@ -1541,7 +1546,17 @@ internal virtual async Task OnSourceFileAdded(SessionId sessionId, SourceFile so | |
| { | ||
| if (req.TryResolve(source)) | ||
| { | ||
| await SetBreakpoint(sessionId, context.store, req, true, false, token); | ||
| try | ||
| { | ||
| await SetBreakpoint(sessionId, context.store, req, true, false, token); | ||
| } | ||
| catch (DebuggerAgentException e) | ||
| { | ||
| //it's not a wasm page then the command throws an error | ||
| if (!e.Message.Contains("getDotnetRuntime is not defined")) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be useful to add a comment next to |
||
| logger.LogDebug($"Unexpected error on RuntimeReady {e}"); | ||
| return; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.