diff --git a/ICSharpCode.Decompiler.Tests/TestCases/VBPretty/YieldReturn.cs b/ICSharpCode.Decompiler.Tests/TestCases/VBPretty/YieldReturn.cs index 78c047ac1..0103871bc 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/VBPretty/YieldReturn.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/VBPretty/YieldReturn.cs @@ -1,8 +1,5 @@ using System; using System.Collections.Generic; -#if LEGACY_VBC -using System.Diagnostics; -#endif using Microsoft.VisualBasic.CompilerServices; @@ -23,9 +20,6 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.VBPretty { private int fieldOnThis; -#if LEGACY_VBC - [DebuggerStepThrough] -#endif public static IEnumerable YieldChars { get { yield return 'a'; diff --git a/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs b/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs index ea56949f0..ea43eabd4 100644 --- a/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs +++ b/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs @@ -1807,6 +1807,10 @@ namespace ICSharpCode.Decompiler.CSharp if (function.StateMachineCompiledWithLegacyVisualBasic) { RemoveAttribute(entityDecl, KnownAttribute.DebuggerStepThrough); + if (function.Method?.IsAccessor == true && entityDecl.Parent is EntityDeclaration parentDecl) + { + RemoveAttribute(parentDecl, KnownAttribute.DebuggerStepThrough); + } } } if (function.IsAsync)