Serious ASP.NET Editor flaw lives on in VS.NET 2003
Several (ok, a lot) of people have been bitten by the "I-format-your-HTML-code-as-I-please"-bug in the ASP.NET HTML editor in Visual Studio.NET v2002. To recap what the bug does to you: you are working in HTML view on a page. You have to do this because f.e. you are working on a repeater template. Because you are a good developer, you create a readable layout of your code, so also for this HTML. When you come to the point where you have to add a control to your ASP.NET page, you have to switch over to design view, drag it from the toolbox onto the page, switch back to HTML view to add f.e. templates or additional properties or even position it correctly. When you switch back from design view to HTML view, your code sometimes (not allways) gets reformatted randomly, even if you switch off any auto-formatting feature in Visual Studio.NET. Hitting control-z undo's this formatting, but it gets annoying over time.
When Visual Studio.NET 2003 hit the streets, people were expecting a fix for this bug. However... it's still there. Someone started a thread about this in the microsoft.public.vsnet.general newsgroup, demanding an explanation about this behaviour and why it wasn't fixed (because literally hundreds of people have posted this bug in that said newsgroup before). The complete thread can be found here.
Today, Mike Moore of Microsoft posted a new posting in that thread about his investigations about this matter, and it might be of interest to some of you so I'll post the message directly.
(c) Mike Moore/Microsoft.
SUMMARY
This thread is discussing a problem with the Visual Studio .NET development environment for ASP.NET. If you type directly into the HTML view of the ASPX page, sometimes VS will reformat what you have typed. As is shown by the other posts in this thread, this bug is affecting many people.We already discussed two "partial" workarounds. These help, but do not fix the problem. I also wrote that I would try to find out more about why we did not fix this problem with the release of VS 1.1.
These are the workarounds.
1) Undo
Each time you return to HTML view, immediately run Undo. The formatting changes mostly take place when you switch from design view to HTML view and these changes are mostly in a single undo entry. Calling undo then reverses many of the changes.2) Save
Saving the ASPX page just prior to switching to design view reduces the amount of reformatting the next time you switch back to HTML view.---
Regarding the explanation, I first want to apologize for taking so long to get back to you all.I found that the development team did seriously consider this bug. The first thought was to add an option to turn off the reformatting feature. Unfortunately, it turned out to be deeply integrated in the code that makes the editor useful. So, it could not be turned off. Nor could it easily be fixed. Any changes made to this area of the code would definitely impact many aspects of the editor.
If they could go back in time and rethink that decision, things might be otherwise. However, at the time, the development team looked at all the information they had available and decided that trying to fix this for the 1.1 release would cause more harm than good.
My opinion about this can be read in the thread linked, but to sum it up: I'm very dissapointed. It's a text-editor for crying out loud. If you can't preserve tabs in text, something is seriously wrong. And what's worse: this won't be fixed until next major release of Visual Studio.NET, which will not see the light of day before Q2 2004.