Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mayday mayday, .NET is eating my code!

Status
Not open for further replies.

gd082

Programmer
Mar 12, 2002
42
0
0
BE
Since yesterday, Visual Studio sometimes "eats" my code. All of a sudden some textboxes, labels, listboxes and dropdownlists disappear. This is really annoying, especially when you don't know exactly what was on the page. The strange thing is that those items are still on the list in the aspx.vb - page. It's only the HTML-code that is flying away.

Is this a bug? Or am I the only one with this problem?
 
You can try the following:
in .net design
tools -> options -> (from the list)HTML/XML -> Format -> turn off any autoformat.
I think it has something to do with a setting in this window.
 
I really hope this is the solution, cause I lost a lot of time with this...

thx
 
I hope so too, like I say:
I think it has something to do with a setting in this window
I am not 100% sure.
 
Hey guys,

we had/have the same problems. Not sure what the cause is, not sure why (although I'm going to turn off the autoformatting on mine too, thanks for the tip Harm).

We make a point of saving often, and always before switching to html view (which is when it usually happens).

That way, if your code does get eaten, you can just close without saving and reopen the project, and your code will be back.

Jack
 
A couple of the interesting ones I have had happen to me a couple of times are the following so if you have strange errors you might want to watch for this.

When adding a new built in web control (in design view) to a user control. All other built in controls on the page are set to protected even if you have set them to public (I know I probably shouldn't have them public but it was a particular situation where I needed them public)
------Resulted in compile error

When adding or removing a built in web control (in design view) the entire contents of the InitializeComponent() function in the generated code section was wiped out.
------Results in controls performing no actions and or page load events not firing

Crystal
crystalized_s@yahoo.com

--------------------------------------------------

Experience is one thing you can't get for nothing.

-Oscar Wilde

 
Harm, I'm sorry I have to say it, but your solution isn't working. I just had a whole page wiped out, accept from one little button. This program is really nuts, I was lucky I made a copy of the project yesterday evening!

It was not because I was going to the HTML-code, I was just altering some code in the aspx.vb page, after this I just watched the aspx page to make sure everything was ok, it was so I tried to debug. Suddenly he didn't find a label he had to fill, I thought I was getting a heart attack. The project crashed, and I went to the aspx-file : only one silly button left!

Strange thing is : a friend of mine, sitting next to me, has had this only once, a couple of weeks ago, and he works on Windows XP. I had this 'bout 10 times this week while I'm working on 2K. So I was thinking : is it a problem with the OS? (It would be a little weird, but microsoft is microsoft...)
 
One thing I have noticed about the .Net IDE is that when you are working with web forms, if you switch to design view you need to let the designer render all the controls on the page before you switch to HTML view.

It's not totally consistent, but on pages with many controls, I have found that if I don't let the designer render everything before I switch to HTML view, then .Net will indeed "eat" my code.

At that point, it's simply a matter of closing the form without saving changes and re-opening it.

Hope this helps
 
I don't go near HTML view unless I have a backup before going in. Since "rendering" takes place at design time as well as run-time, any little glitch introduced by "manual" intervention can send it off into never-never land. Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top