You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code fix to remove pointlessly overridden methods works as expected, except for cases where the overridden method comes immediately after, or comes immediately before a #region or #endregion directive.
In such cases, extra new lines are left in the returned document.
This leads to SA1507 errors on the lines between the #region directive and the following method.
The text was updated successfully, but these errors were encountered:
andrewhongnsw
changed the title
WTG3007 code fix adds extra new lines when overridden member is adjacent to to a #region or #endregion
WTG3007 code fix adds extra new lines when overridden member is adjacent to a #region or #endregion
Feb 7, 2023
This is somewhat expected. We remove the method, but keep exterior trivia (leading and trailing). If there are comments there, or in your case #region trivia, we want to keep it.
If we want to get fancy and start balancing the trivia ourselves, then we'd have to pick one set of rules to use. SA1507 doesn't like the multiline whitespace, but it is also feasible for a project to have the opposite and require two blank lines - or to require no blank lines at all.
SA1507 also includes a code fix, so you should be able to immediately fix up that secondary warning too.
The code fix to remove pointlessly overridden methods works as expected, except for cases where the overridden method comes immediately after, or comes immediately before a
#region
or#endregion
directive.In such cases, extra new lines are left in the returned document.
For example a code fix on the following snippet:
Will lead to:
This leads to
SA1507
errors on the lines between the#region
directive and the following method.The text was updated successfully, but these errors were encountered: