Misinterpreting format for FileHeader rule

We are using SonarLint in VS2019 with SonarCloud.

The S1451 rule “Add or update the header of this file.” has been configured like so in the SonarLint.xml

          <Value>\/\/ -{71,}(\n|\r|\r\n)\/\/ &lt;copyright file=".*\.cs" company=".*"&gt;(\n|\r|\r\n)\/\/\s{5}Copyright \(c\) Magic Bullet Ltd. All rights reserved.(\n|\r|\r\n)\/\/ &lt;\/copyright&gt;(\n|\r|\r\n)\/\/ -{71,}</Value>

Note the start of the RegEx is saying the header should start with

  1. //
  2. then a space character
  3. then 71 “-”
  4. then a newline character

Something similar is at the end of the regex so as two give the header a top and bottom box of

// -----------------------------------------------------------------------------------------------

However if I goe into the code window and select quickfix “Add file header” the preview popup shows that it is ignoring the surrounding box

Here is a screenshot showing the “quick action” and you can see the missing surround box and the attempt to add five spaces before the "Copyright with “\s{5}”

What am I doing wrong?

Hello @pat_munkiisoft,

Thanks for you feedback. It seems that this topic is a duplicate to this:

Please read topic I linked and leave a comment there to get support and take part in discussion.
To avoid splitting discussion to several topics I will close this one.
Have a good day!