[wasm][debugger] Skip generated wrappers when trying to step into/out with JustMyCode...
authorThays Grazia <thaystg@gmail.com>
Tue, 7 Feb 2023 19:48:36 +0000 (16:48 -0300)
committerGitHub <noreply@github.com>
Tue, 7 Feb 2023 19:48:36 +0000 (16:48 -0300)
* Skip generated wrappers when trying to step.

* Changing to use  System.Diagnostics.DebuggerNonUserCode

src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/Constants.cs
src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSExportGenerator.cs
src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportGenerator.cs

index 5a90431..aab379d 100644 (file)
@@ -10,6 +10,7 @@ namespace Microsoft.Interop.JavaScript
         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";
index 47c79a6..229400e 100644 (file)
@@ -145,6 +145,8 @@ namespace Microsoft.Interop.JavaScript
 
             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);
index 34b9c0b..f4519ac 100644 (file)
@@ -120,6 +120,8 @@ namespace Microsoft.Interop.JavaScript
             // 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);