In Visual studio (2022; v: 17.2.1) when I paste some text into a cshtml file, that same text seems to get copied, but then immediately deleted; including part of existing text. This only seems to happen when overwriting jquery code (anywhere within <script>
tags).
A very similar problem is already discussed here with no (usable) solution:
Preferences -> Source Code -> Code Formatting -> HTML, switch to the HTML Format tab and uncheck Format on paste.