Skip to content

Conversation

@thaystg
Copy link
Member

@thaystg thaystg commented Aug 31, 2021

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1383962

This happens because a WebView embedded in an Android app can call back into the runtime on a native thread that the runtime has not seen before. The callback goes through a wrapper method. The wrapper method is responsible for registering the thread with the runtime. We were incorrectly inserting debugger sequence points in the wrapper method. As a result, if the debugger begins a suspend (which turns on single stepping - which relies on sequence points), the unregistered thread would call back to the debugger which would crash because we have no info about the thread.

@ghost
Copy link

ghost commented Aug 31, 2021

Tagging subscribers to this area: @thaystg
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1383962

Special thanks to @lambdageek for helping me with this PR.

Author: thaystg
Assignees: -
Labels:

area-Debugger-mono

Milestone: -

WrapperInfo *info = mono_marshal_get_wrapper_info (method);
if (info->subtype == WRAPPER_SUBTYPE_INTERP_IN) {
/* We could hit a seq point before attaching to the JIT (#8338) */
seq_points = FALSE;
Copy link
Member

Choose a reason for hiding this comment

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

@BrzVlad Are there other wrappers that might be used to go from native embedder code to the interp?

@vargaz Do we need sequence points in any wrappers? How risky would it be to just disable them for all wrapper methods? Are they used for stopping on a call to a pinvoke or something like that?

Copy link
Member

Choose a reason for hiding this comment

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

that's the only one

@lambdageek
Copy link
Member

/backport to release/6.0-rc1

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2021

Redth pushed a commit to dotnet/maui that referenced this pull request Sep 1, 2021
Blazor android projects (and possibly iOS?) will require this runtime fix: dotnet/runtime#58467

So, enabling interpreter again on non-blazor templates
rmarinho pushed a commit to dotnet/maui that referenced this pull request Sep 1, 2021
* Update OutputType to WinExe on -windows

This happens in the sdk targets/props but not quite early enough to influence the `EnableWin32Codegen` property which causes `[STAThreadAttribute]` to be generated in the Windows app.

* For non-blazor projects, interpreter is fine

Blazor android projects (and possibly iOS?) will require this runtime fix: dotnet/runtime#58467

So, enabling interpreter again on non-blazor templates
@thaystg thaystg merged commit 36e8a22 into dotnet:main Sep 1, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Oct 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants