0

My Visual Studio 2022 community edition is behaving unusually when entering comments inside .aspx files, that should look like this.

/*
* This is a comment
* This is another line
*
*/

I've tested doing the same thing in a .cs file and it works the way I expect. So to confirm, the unwanted behavior is only happening inside code written in between script tags of an aspx file.

<%@ Page Language="c#"%>
<script runat="server">

   Here...

<script/>

In Visual Studio 2017, when I enter a multiline comment manually, I begin typing '/*' and upon pressing return, the carriage return would automatically move to the next line down, prefixing it with a *, and if I continue pressing return, the same would happen. The same is not true with my copy of Visual Studio 2022... where instead, when I type '/*' and press return, my cursor remains flashing just to the right of the *, but the inserted carriage return is added seemingly randomly, 28 or more lines beneath where my cursor is.

Has anyone encountered this? Thanks

2
  • Have you tried repairing Visual Studio? Do you have any extensions installed? Commented Jul 9 at 2:16
  • Thank you - it's a brand new installation with no extensions. Commented Jul 9 at 9:17

1 Answer 1

0
<script runat="server">

   Here...

<script/>

The scrpit format is wrong.

<script/> should be </script>

In addition, if a similar statement <%@ Page Language="c#"%> already exists in the first line of aspx, the duplicate statement will cause the error.

Since code problems cause editor errors and lead to subsequent errors, please check carefully and fix the errors.

1
  • @Shaun Roberts , may I know if you get any chance to check my answer? Commented Jul 17 at 7:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.