From 8a1e99e24fa12d8387a31459d39230cb1a37ebb1 Mon Sep 17 00:00:00 2001 From: Thays Grazia Date: Tue, 7 Feb 2023 16:48:36 -0300 Subject: [PATCH] [wasm][debugger] Skip generated wrappers when trying to step into/out with JustMyCode enabled (#81715) * Skip generated wrappers when trying to step. * Changing to use System.Diagnostics.DebuggerNonUserCode --- .../gen/JSImportGenerator/Constants.cs | 1 + .../gen/JSImportGenerator/JSExportGenerator.cs | 2 ++ .../gen/JSImportGenerator/JSImportGenerator.cs | 2 ++ 3 files changed, 5 insertions(+) diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Constants.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Constants.cs index 5a90431038ac2..aab379d936ba2 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Constants.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Constants.cs @@ -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"; diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSExportGenerator.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSExportGenerator.cs index 47c79a692173c..229400ea4675d 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSExportGenerator.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSExportGenerator.cs @@ -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); diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportGenerator.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportGenerator.cs index 34b9c0bbf869a..f4519ac0039d9 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportGenerator.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportGenerator.cs @@ -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);