Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul 184 posts 646 karma points
    Oct 12, 2015 @ 14:33
    Paul
    0

    Umbraco 7.3 adding whitespace at the top of pages - prevents XML/RSS working

    Hi All,

    We've just upgraded to Umbraco 7.3 from version 7.2.8 and have hit a problem.

    On code which previously worked perfectly well we're now getting additional white space at the top of each page. Whilst this isn't an issue for most pages, for those which have templates to create RSS and XML it is.

    UPDATE: This appears to be happening on all source returned by 7.3.

    E.g.

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{Layout = null;}
    <p>dog</p>
    

    In 7.2.8 returns:

    Line 1: <p>dog</p>
    

    In 7.3 returns:

    Line 1:
    Line 2: <p>dog</p>
    

    Does anyone know how we can fix this?

  • Paul 184 posts 646 karma points
    Oct 12, 2015 @ 14:54
    Paul
    0

    Even putting:

    dog

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{Layout = null;}

    in 7.3 =

    Line 1:
    Line 2: <p>dog</p>
    

    Ideas on a postcard please folks!

  • Paul 184 posts 646 karma points
    Oct 13, 2015 @ 07:38
    Paul
    0

    BTT - any ideas from the morning crowd?

    Is this something to do with 7.3 using MVC 5?

  • Paul 184 posts 646 karma points
    Oct 13, 2015 @ 08:37
    Paul
    0

    We've also tried this method of getting the initial XML declartion at the top of the source returned:

    https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/55476-XML-output-from-Template-has-whitespace-at-the-beginning

    Unfortunately though it also returns a blank line above the XML declaration.

    :-S

  • Paul 184 posts 646 karma points
    Oct 13, 2015 @ 08:38
    Paul
    0

    Just for completeness I've also tried this: https://our.umbraco.org/forum/umbraco-pro/contour/39079-Razor-code-rendered-as-whitespace

    That didn't work either.

  • Steve Morgan 1348 posts 4457 karma points c-trib
    Oct 13, 2015 @ 08:39
    Steve Morgan
    0
    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
    Layout = null;
    }<p>dog</p>
    

    Works for me - e.g. no whitespace after the brace } - I've always understood to be the case?

  • Paul 184 posts 646 karma points
    Oct 13, 2015 @ 08:55
    Paul
    0

    Ok I'm totally confused. I've this tried in a brand new template on a blank page (with no other templates inherited or anything like that) and get:

    Line 1: 
    Line 2: <p>dog</p>
    

    It's feels like @inherits Umbraco.Web.Mvc.UmbracoTemplatePage is rendering as a blank line :-s

  • Paul 184 posts 646 karma points
    Oct 13, 2015 @ 08:58
    Paul
    0

    I'd also add that on this very page if you inspect element the you get:

    Line1 : 
    Line2 :<!doctype html>
    Line3 :<!--[if lt IE 7]> <html xmlns:umbraco="http://umbraco.org" class="no-js ie6 oldie" lang="en"> <![endif]-->
    Line4 :<!--[if IE 7]>    <html xmlns:umbraco="http://umbraco.org" class="no-js ie7 oldie" lang="en"> <![endif]-->
    

    etc

  • Paul 184 posts 646 karma points
    Oct 13, 2015 @ 09:01
    Paul
    0

    Same applies on this page too (line 1 is a blank line):

    https://our.umbraco.org/contribute/releases/730

    This leads me to believe this issue is with either Umbraco 7.3 or the way in which 7.3 works with MVC5.

    If other people with 7.3 could confirm/deny that they also get a blank line for line 1 when viewing page source that would at least help ensure I can list this as a bug.

  • Paul 184 posts 646 karma points
    Oct 14, 2015 @ 07:44
    Paul
    0

    If other people with 7.3 could confirm/deny that they also get a blank line for line 1 when viewing page source that would at least help ensure I can list this as a bug.

    Anyone?

  • Paul 184 posts 646 karma points
    Oct 14, 2015 @ 10:04
    Paul
    0

    We've gone back to 7.2.8 and this issue isn't present, thus the problem is within 7.3+.

  • Sebastiaan Janssen 5058 posts 15520 karma points MVP admin hq
    Oct 14, 2015 @ 11:22
    Sebastiaan Janssen
    0

    Hehe, the page you're refering to (https://our.umbraco.org/contribute/releases/730) uses a masterpage instead of a view, so that's not related.

    Have you tried Steve's suggestion of putting it right after the closing brace? Seems to work for me and that's how it always worked as far as I can remember:

    enter image description here

  • Paul 184 posts 646 karma points
    Oct 14, 2015 @ 12:59
    Paul
    0

    Yep I tried all that Sebastiaan, the best I could ever get was one blank line prior to code appearing (naturally this was one of the first things I tried). I even resorted to opening the template in a binary editor to ensure there was no white space in it.

    Even with

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{Layout = null;}<p>dog</p>
    

    We still get a blank line for line 1 of the outputted code.

    We're at a total loss as to why this is happening :-s

  • Sebastiaan Janssen 5058 posts 15520 karma points MVP admin hq
    Oct 14, 2015 @ 11:33
    Sebastiaan Janssen
    0

    As suspected, it's the same in 7.2.8 , doesn't work unless you put the html/xml on the same line as the closing curly brace.

    enter image description here

  • Paul 184 posts 646 karma points
    Oct 14, 2015 @ 13:06
    Paul
    0

    On our 7.2.8 site we have no issue with this. Just on the 7.3 site. Both are new, virtually empty sites.

  • Steve Morgan 1348 posts 4457 karma points c-trib
    Oct 14, 2015 @ 13:13
    Steve Morgan
    0

    When I tested this it was with Visual Studio 2013 so not MVC5... I take it you're using 2015?

  • Sebastiaan Janssen 5058 posts 15520 karma points MVP admin hq
    Oct 14, 2015 @ 13:22
    Sebastiaan Janssen
    0

    VS version doesn't matter. This is all MVC and nothing to do with Umbraco. :)

  • Steve Morgan 1348 posts 4457 karma points c-trib
    Oct 14, 2015 @ 14:26
    Steve Morgan
    0

    I was under the impression that only VS 2015 forced MVC 5 - apologies for providing confusion!

Please Sign in or register to post replies

Write your reply to:

Draft