Wednesday, March 28, 2012

VisualStudio corrupts ASPX page when opened in Designer

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.
kingflux wrote:
> 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?
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">
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199...2006
"kingflux" <tim@.eNardoni.com> wrote in message
news:1163793245.418928.29790@.e3g2000cwe.googlegroups.com...
> 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.
>
And yet it works fine if I never open the file in VisualStudio. ?
I'm extremely . 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?
Mark Fitzpatrick wrote:
> 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 ca
n
> put pixel definitions for width is when you are using CSS. The following w
ay
> would be legal: <tr style="height:5px">
>
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.)
kingflux wrote:
> And yet it works fine if I never open the file in VisualStudio. ?
> I'm extremely . 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?
>
> Mark Fitzpatrick wrote:

0 comments:

Post a Comment