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.
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.


  • Maybe as an interim solution they could fix the problem in the upcoming release of the Web Matrix.

  • This bug was making me very upset and I could not understand why it was still happening, even though I had turned off all auto-formatting options in VS.NET. I just found out that is a well-known bug.

    Not only the editor is having this irritating "I-will-do-it-for-you” behavior, but also the final "smart" formatting that is applied is (usually) completely messed up. A child programmer would have done better.

    A workaround that I have been using, whenever the editor messes up the HTML code, is to copy and paste the HTML code to an blank XML file, apply the XML auto-formatting (with line breaks) and copy it back to the HTML. The XML auto-formatting feature is much more intelligent and neat than the HTML one and, usually, complies with my HTML indentation style.

    I hope the hint helps someone else.


  • I've been doing web design in asp for nearly 3 years and I'm now migrating to All I can say is that this bug shows how pathetic microsoft's visual studio design team is and its OBVIOUS none of them have ever done any real web dev in their careers. I also dont know how a bug like this could get past the testing level unless it was completely ignored for reasons stated by Mike Moore in his letter. This bug is seriously so annoying it makes me want to stab out my eyeballs with a rusty spoon. It makes the design view completely useless for everyone but newbies who create their high school web project from an oreilly book.

  • I am using Visual Studio 2003 and it looks like this problem is fixed. In old Visual Studio it used to strip "Style" in <td> tag, but it's no longer doing it.

    Can someone verify this?



  • Not only is this an annoying bug but I've got one worse. For some reason, the event wiring code that hooks buttons and other control's postback events to the code behind .cs file, dissapears, seemingly randomly, when a .aspx file is saved. Doesn't happen everytime but when the client calls up and says some button doesn't work anymore, it really sucks.

    And that explanation for why the bug didn't get fixed is such BS. How many billions in cash does MS have in the bank? Hire consultants if your team is too la.. uh, uh, unable to rewrite the code.

  • I have stopped all major development with until this bug is fixed.

  • I am also having issues with the .net HTML editor, in addition to the automatic formatting problem. Has anyone expereinced the disappearance of OnClick events, set in asp:imagebutton properties, upon saving HTML formatting changes in .net???

  • See my comment just above yours. This bug has bit me several times.

    It really sucks to get a bug report from a client on something that worked yesterday.

  • Having Used Dreamweaver to create pages before using I was appalled at how difficult it was to do the most simple of things, i was ending up designing the page in dreamweaver and then adding the code behind afterwards ( didn't like this either but it did help a bit) I really do hope they can sort this problem out for the next version and the manipulation of tables (quite a simple task but very irritating). Maybe some better css integration as well (we can but dream!!!)

  • The next version (whidbey) is really nice, they definitely are doing a great job fixing all the poop they sold us and are selling us even today.

    But that's the future of course, it's not helping us today.

    Caveman: you can select dreamweaver as the default html editor in I have done that with homesite. Of course you have to manually tie controls to event handlers and have to declare them by hand in the code behind, but for the rest it's pretty seamless.

  • After waiting nearly two years to jump to the .NET boat, and only three days of actual coding time, I'm thoroughly disgusted with VS.NET. How the heck am I supposed to master code-behind if code-in-front can't even stay together? It can't keep 50 lines of simple HTML in order. I've used InterDev for years for classic ASP (without using the DTCs because they're broken). I looked forward to VS.NET because all the design-time controls were supposed to work. Finally. Well. Hmmm. I'm about ready to quit .NET,'s bad enough that I have 30,000 lines of ASP code to move over; I don't need to fight the IDE too.

  • Here is something odd to check out. I wrote the following line in html and switched to design without saving, then switched back to html.

    &lt;a href='javascript:windowHandle =;<a target="_new" href=";,&quot;_blank&quot;,&quot;width=400,height=400,resizable=yes,toolbar=yes,menubar=yes,location=no,scrollbars=yes&quot;">;,&quot;_blank&quot;,&quot;width=400,height=400,resizable=yes,toolbar=yes,menubar=yes,location=no,scrollbars=yes&quot;);windowHandle.focus();'&gt;&lt;u&gt;View Map&lt;/u&gt;&lt;/a&gt;

    If you hit save before switching views or use the following line - single and double quotes are reversed - it works perfectly.

    &lt;a href=&quot;javascript:windowHandle ='','_blank','width=400,height=400,resizable=yes,toolbar=yes,menubar=yes,location=no,scrollbars=yes');windowHandle.focus();&quot;&gt;&lt;u&gt;Yahoo&lt;/u&gt;&lt;/a&gt;

  • im very dissapointed. is supposed to be a &quot;production ready&quot; IDE. i've lost hours to this bug. if it were up to me, i'd be doing php in jedit.

  • The editor also has problems with inline styles:

    &lt;img style=&quot;position: absolute; top: &lt;%= SomeValue %&gt;&quot; src=&quot;/img.gif&quot;&gt;

    When switching back and forth from design to html view, the 'top: &lt;%= SomeValue %&gt;' part gets completely removed...

  • Took me over 20 mins to find this post and I'm glad I did. What a POS that M$ doesn't fix a problem they knew was there. Still no work-arounds, patches, or fixes for this problem one year later? WTF?

  • Man this issue really bothers me as I think about it more. What kind of a development team says &quot;ah, the bug is just too big to fix?&quot; Seriously, think about development you've all done and I'm sure you've never said &quot;well, it's just too big of a bug to bother with - I'll fix the small ones, though.&quot; I don't care how big of a bug it is! If it's a known HUGE bug (like it obviously is) THEN MAKE IT WORK!

  • Thanks for posting info about this bug. It's been driving me absolutely nuts. At first I thought I didn't have my IDE settings configured properly. Now I know that it's a .NET bug and others have been going through the same frustration as me.

  • Please help me turn this feature off! When I paste an &lt;input/&gt; with an id attribute, the .NET editor replaces the id with a unique one, even though I am going to delete the other part, or use it in a modified way.

  • Man, this bug drives me craaazy! Maybe Microsoft should take a look at Dreamweaver or GoLive, and see how a proper editor will never alter your formatting.

  • This bug has cost the company I'm working for countless man hours, and a whole crap load of $$$.

    Thanks Microsoft.

  • I find myself every few months checking in on this problem in the hope that MS would do the right thing and release a fix but as always has happened over the last 2 years I am still waiting. I have always been an early adopter of new MS technologies in the past and have seen my fair share of bugs but I can't remember ever being more frustrated for such a long period of time as with this bug. With the new version on the horizon I am going to have to answer the question &quot;Do I want to trust MS again?&quot;. Damn good question!

Comments have been disabled for this content.