Skip to content

Commit

Permalink
[wasm][debugger] Skip generated wrappers when trying to step into/out…
Browse files Browse the repository at this point in the history
… with JustMyCode enabled (#81715)

* Skip generated wrappers when trying to step.

* Changing to use  System.Diagnostics.DebuggerNonUserCode
  • Loading branch information
thaystg committed Feb 7, 2023
1 parent b45ee2b commit 8a1e99e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ internal static class Constants
public const string JSImportAttribute = "System.Runtime.InteropServices.JavaScript.JSImportAttribute";
public const string JSExportAttribute = "System.Runtime.InteropServices.JavaScript.JSExportAttribute";
public const string JavaScriptMarshal = "System.Runtime.InteropServices.JavaScript.JavaScriptMarshal";
public const string DebuggerNonUserCodeAttribute = "System.Diagnostics.DebuggerNonUserCode";

public const string JSFunctionSignatureGlobal = "global::System.Runtime.InteropServices.JavaScript.JSFunctionBinding";
public const string JSMarshalerArgumentGlobal = "global::System.Runtime.InteropServices.JavaScript.JSMarshalerArgument";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ private static MemberDeclarationSyntax PrintGeneratedSource(

MemberDeclarationSyntax wrappperMethod = MethodDeclaration(PredefinedType(Token(SyntaxKind.VoidKeyword)), Identifier(wrapperName))
.WithModifiers(TokenList(new[] { Token(SyntaxKind.InternalKeyword), Token(SyntaxKind.StaticKeyword), Token(SyntaxKind.UnsafeKeyword) }))
.WithAttributeLists(SingletonList(AttributeList(SingletonSeparatedList(
Attribute(IdentifierName(Constants.DebuggerNonUserCodeAttribute))))))
.WithParameterList(ParameterList(SingletonSeparatedList(
Parameter(Identifier("__arguments_buffer")).WithType(PointerType(ParseTypeName(Constants.JSMarshalerArgumentGlobal))))))
.WithBody(wrapperStatements);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ private static MemberDeclarationSyntax PrintGeneratedSource(
// Create stub function
MethodDeclarationSyntax stubMethod = MethodDeclaration(stub.SignatureContext.StubReturnType, userDeclaredMethod.Identifier)
.AddAttributeLists(stub.SignatureContext.AdditionalAttributes.ToArray())
.WithAttributeLists(SingletonList(AttributeList(SingletonSeparatedList(
Attribute(IdentifierName(Constants.DebuggerNonUserCodeAttribute))))))
.WithModifiers(StripTriviaFromModifiers(userDeclaredMethod.Modifiers))
.WithParameterList(ParameterList(SeparatedList(stub.SignatureContext.StubParameters)))
.WithBody(stubCode);
Expand Down

0 comments on commit 8a1e99e

Please sign in to comment.