VisualStudio corrupts ASPX page when opened in Designer

  • Thread starter Thread starter kingflux
  • Start date Start date
K

kingflux

Hello-- When I open an existing file (NoodlePage.aspx), VisualStudio
immediately changes around some lines, removes a few characters, and
switches some tags. I used fc.exe to compare the before and after;
even if I manually change each one back to the original, I get an
'Object reference not set to an instance of an object' error upon
viewing the page.

I can put back the original ASPX file and the original RESX file, and
the page works fine.

I applyied Visual Studio SP1 yesterday, but it did not fix this.

Any suggestions?
 
This is probably because you have some invalid html. If Visual Studio
doesn't understand the html, I've seen it try to fix things. Try
opening the original page, viewing the page source, and make sure you
address any warnings that Visual Studio gives you.
 
Thank you for writing, Eric. There are no warnings in the Designer or
in the build process.

It's changing things like:

<tr height="5px"> to <tr height="5">

and switched my top four lines out of order. I suspect that it is also
corrupting the associated RESX file.
 
It's doing it correctly because <tr height="5px"> is an illegal HTML
statement, hence the translation into the other form. The only time you can
put pixel definitions for width is when you are using CSS. The following way
would be legal: <tr style="height:5px">
 
And yet it works fine if I never open the file in VisualStudio. ???

I'm extremely confused. I can handle the 5px --> 5 conversion, but why
does it corrupt the file(s) to the point where I get an error during
runtime but not during build?
 
Finally figured this out on my own. VisualStudio was adding
declarations to the code behind this ASPX page (NoodlePage.aspx.vb) and
not telling me!

The declarations exist correctly in the base/inherited page
(NoodleBase.vb), so these new declarations were conflicting. I can
delete the inserted declarations, save the file, and debug without the
fatal error.


(Microsoft products are helpful -- until you really need them to be.)
 
Back
Top