Okay, it was definitely an internal error with Visual Studio, and from what I see (tags from other classes like XAML, which my project has nothing to do with etc) it's a serious one. Something in internal cache got corrupted somehow.
I've solved the problem by:
- Cleaning solution (didn't change anything, but it was my first step)
- Copying the text somewhere else
- Deleting the
web.config
file completely. - Closing, reopening VS
- Re-creating an empty
web.config
- Pasting the text back to the new file.
Even though it seems trivial, I think Visual Studio wasn't parsing the file again even when I changed the content. Deleting the file completely and closing VS probably erased everything related to the file from the internal cache, and when I pasted my perfectly correct XML into the new file, it forced to reparse, solving the problem.