locked
VS 2015 ruins the <div's making them < div RRS feed

  • Question

  • User2142845853 posted

    Its happened about 4 times now in a few months.  

    Im in the Edit.cshtml or similar MVC view where its a mix of c# and html.  The file is 5000 lines of code or so.  Im touching up ONE control.  hit the space bar a few times?  spinny wheel.  visual studio is not responding...  ok  wait a while.  now I can get a few chars typed in.  spinny wheel.  not responding... wait  wait...

    then save and run? 

    Server Error in '/' Application.


    Parser Error

    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

    Parser Error Message: Encountered end tag "div" with no matching start tag.  Are your start/end tags properly balanced?

    Line 3504:                        </div>
    Line 3505:                    </div>
    Line 3506:                </div>
    Line 3507:                                @*</div>*@
    Line 3508:                                        // END OF THIS SECTION  

    after TWO HOURS of only getting a few chars typed having it stall and stall, I finally remember this visual studio BUG where for no reason it obliterates <div statements at random

    \Edit.cshtml(755):                        < div class="form-group">
    \Edit.cshtml(1528):                        < div class="page-header">
    \Edit.cshtml(2143):                        < div class="page-header">
    \Edit.cshtml(2586):                        < div class="page-header">
    \Edit.cshtml(2797):                        < div class="page-header">
    \Edit.cshtml(3012):                        < div class="form-group">
    \Edit.cshtml(3115):                        < div class="form-group">
    

    do a search for the offending div statements, after fixing several its down to only 7.    but wait, thats not all...

    \Edit.cshtml(1527):                    <div id = "tabs-5" >
    \Edit.cshtml(2142):                    <div id = "tabs-6" >
    \Edit.cshtml(2585):                    <div id = "tabs-7" >
    \Edit.cshtml(2796):                    <div id = "tabs-8" >
    \Edit.cshtml(3011):                    <div id = "tabs-9" >
    \Edit.cshtml(3114):                    <div id = "tabs-10" >
    \Edit.cshtml(3346):                        <div id = "tabs-11" >

    and how many like this:  ></ script >

    Friday, April 8, 2016 8:39 PM

Answers

  • User364663285 posted

    From the error message, surely it is due to un-paired div.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 14, 2016 2:02 AM

All replies

  • User-166373564 posted

    Hi Rogersbr,

    Parser Error Message: Encountered end tag "div" with no matching start tag.  Are your start/end tags properly balanced?

    According to the error message above, there is no matched "div", so you need format your HTML code. These are the steps:

    In the case of HTML, you can go pretty deep into the formatting options by clicking on the Tag Specific Options button:

    Please let me know if it still has same issue.

    Regards,

    Angie

    Monday, April 11, 2016 6:27 AM
  • User2142845853 posted

    Hi Angie

    I can tell you this is assuredly a 'bug' in visual studio.  Its happened to me at least 4 times in the past year.  When there is a .cshtml file with in my case over 5000 lines of code, most all of it html, 100s of divs, suddenly it corrupts the entire source file and it is visual studio putting spaces in between the < and the div, rendering them invalid, causing html errors.

    Are you saying the format tool will seek out and fix the div's that were damaged by visual studio?  what I did was do a search for < div with the space, or div  /> and go to each one and fix them, no pattern to how VS corrupts the div code that I can describe.  it took me over 2 hours to find and fix this, as I was working on one section but fortunately always make a copy of the file Im about to modify;  it was so bad that hitting space or typing? it would stall visual studio while it analyzed 'whatever'

    type a few more chars? stall.  one sentence would take literally 6 minutes.   once i copied that source and did a compare to the starting source? all the bad divs were highlighted all thru the code where i never touched...

    Thursday, April 14, 2016 12:23 AM
  • User364663285 posted

    From the error message, surely it is due to un-paired div.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 14, 2016 2:02 AM
  • User-166373564 posted

    Hi rogersbr,

    Thanks for your feedback.

    From your description above, I think you might try looking for a few more advanced alternatives, for example:

    •Cleaning and rebuilding your current Project (Right-click > Clean, Right-click Rebuild respective) and see if that makes any difference at all. 

    •Stop your existing application and ensure that you don't have any additional IIS processes or instances of your local Web Server running.

    •If these issues are still persisting after the above steps, try restarting Visual Studio (and even your local machine)

    Regards,

    Angie

     

    Monday, April 18, 2016 8:41 AM