2019 R1 Grid Stack Overflow on Template columns

13 posts, 0 answers
  1. eSimSE
    eSimSE avatar
    10 posts
    Member since:
    Aug 2012

    Posted 14 Feb 2019 Link to this post

    After upgrading to 2019 R1, grid template columns that used to work are no longer working. I am getting a stack overflow error. I believe that I have updated all of my files appropriately. Is anyone else having this problem?

    columns.Template(@<text></text>)

    .ClientTemplate("<button class=\"k-button\" name=\"groupBtn\" onclick=\"EditGroups('#=Id#')\"><span class='k-icon k-i-edit'></span></button>")
    .HeaderHtmlAttributes(App.HdrAttr)
    .HtmlAttributes(App.BtnAttr)
    .Title("Districts");

  2. Georgi
    Admin
    Georgi avatar
    685 posts

    Posted 18 Feb 2019 Link to this post

    Hello,

    I have tested the same column on my end and it seems to be working as expected. Note that within the click handler I simply logged a message in the console.

    Could you please make sure that the endless loop is not due to the logic within the click handler?

    Also, could you send us the whole error message including the stack trace?

    Having said that, sharing a demo that clearly replicates the issue would definitely help us fully understand the case and we will be able to provide further assistance to the best of our knowledge.


    Regards,
    Georgi
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.

  3. Emmsa
    Emmsa avatar
    66 posts
    Member since:
    Oct 2006

    Posted 22 Feb 2019 Link to this post

    Hi,

    I'm hijacking this thread to report a similar problem with Telerik UI for ASP.NET Core. I know that it's technically a different product, but my issue:

    • is also related to template columns
    • started to appear with the 2019 R1 release of the Grid
    • is also about a stack overflow

    Example code:

    <div class="row">
        <div class="col-md-12">
            @(Html.Kendo().Grid<ProductViewModel>()
                .Name("gridAjusteBajaPosterior")
                .Columns(columns =>
                {
                    columns
                        .Template("<input id='chk#=ProductID#' type='checkbox' class='k-checkbox row-checkbox'><label style='text-align: right; margin-top: 3px; margin-left: 10px;' class='k-checkbox-label' for='chk#=ProductID#'></label>")
                        .Width(ViewBag.GridButtonColumnWidth)
                        .HtmlAttributes(new { style = "white-space: nowrap" })
                        .ClientHeaderTemplate("<input id='chkSelectAll' type='checkbox' class='k-checkbox row-checkbox'><label style='text-align: right; margin-top: 3px; margin-left: 10px;' class='k-checkbox-label' for='chkSelectAll'></label>");

                    columns.Bound(m => m.ProductID);
                    columns.Bound(m => m.ProductName);

                })
                .Sortable()
                .Pageable()
                .AutoBind(true)
                .DataSource(dataSource => dataSource
                    .Custom().Transport(t => t.Read(r => r.Url("https://demos.telerik.com/kendo-ui/service/products").DataType("jsonp")))
                )
            )
        </div>
    </div>

    View Model:

        public class ProductViewModel
        {
            public int ProductID { get; set; }

            public string ProductName { get; set; }
        }

     

    Some details:

    • this worked perfectly fine up to at least 2018 R2 (2018.2.620). It stopped working when I upgraded to 2019 R1 (2019.1.220), without any changes on the code from my part (I jumped straight from 2018 R2 to 2019 R1, so I can't comment on 2018.3.911)
    • the above code only breaks if I set the column with with a value from ViewBag. I'm checking that the ViewBag (and the GridButtonColumnWidth property) is not null. Currently it's value is 87. If I use that value directly, it works just fine.
    • it only breaks on template columns. Setting the column with using the ViewBag on regular columns works just fine.
    • I'm getting a StackOverflowException

    Console output:

    Emmsa.Test> info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]

    Emmsa.Test>       Executed action method Emmsa.Test.Controllers.TestControllerIndex (Emmsa.Test), returned result Microsoft.AspNetCore.Mvc.ViewResult in 0.2429ms.

    Emmsa.Test> info: Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor[1]

    Emmsa.Test>       Executing ViewResult, running view Index.

    Emmsa.Test>

    Emmsa.Test> Process is terminated due to StackOverflowException.

     

  4. Georgi
    Admin
    Georgi avatar
    685 posts

    Posted 26 Feb 2019 Link to this post

    Hello Emmsa,

    I have tested the very same column on my end but it seems to be working as expected. For your convenience I am attaching the sample I used for testing. Please examine it and let me know what I am missing.

    Furthermore, could you please try to explicitly cast the value from the ViewBag and let me know if the issue still occurs?

    e.g.

    .Width((int)ViewBag.GridButtonColumnWidth)


    Regards,
    Georgi
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. Emmsa
    Emmsa avatar
    66 posts
    Member since:
    Oct 2006

    Posted 27 Feb 2019 in reply to Georgi Link to this post

    Hi Georgi,

    Thanks for your testing! I'm sorry for not getting back to you sooner, but I'm in the middle of a release, and I'll need more time to give you a definitive answer. From a quick test, I can confirm the attached sample works. So I'll need to look a bit deeper into the issue, as this implies there's something else at play.

    In the mean time I've rolled back to 2018 R2 for the time being, but I'll definitely look at this later this week as I'm very much interested in finding the root issue and solve it.

    Regards,

     

  6. Georgi
    Admin
    Georgi avatar
    685 posts

    Posted 28 Feb 2019 Link to this post

    Hi Emmsa,

    Take your time to examine the sample. Once you are done examining the sample let me know what are the steps to reproduce the issue and I will further investigate the case.


    Regards,
    Georgi
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  7. Emmsa
    Emmsa avatar
    66 posts
    Member since:
    Oct 2006

    Posted 01 Mar 2019 in reply to Georgi Link to this post

    Hi Georgi,

    After some further testing, I can confirm that if I explicitly cast the value from the ViewBag to int, the issue disappears, at least in the few cases in which I tried it. This is a pattern I use in a lot of places, so the testing is not 100% conclusive, but still.

    So, a preliminary conclusion would be that *something* seem to have changed between 2018 R2 and 2019 R1, making the explicit cast in this scenario mandatory. Is this the expected behavior? This wasn't the case before, at least up to with 2018 R2. I'm curious about where the suggestion about the explicit cast comes from.

    I've not been able to reproduce the issue in your example yet, though. I'd need some more time for that. I couldn't find out what needs to be added (or removed) from the sample to reproduce the issue there yet.

    Best regards,

    --
    Javier

     

  8. Georgi
    Admin
    Georgi avatar
    685 posts

    Posted 05 Mar 2019 Link to this post

    Hello Javier,

    I have examined the commits for the GridColumnBase.cs class and I can confirm that there are no modifications for the Width configuration with the latest release. Having said that, the change might be in the .Net Core framework - not in the Kendo library.

    Generally speaking, C# is a strongly typed language and working with dynamics is not a good practice. I would recommend casting the values to their corresponding types when possible.


    Regards,
    Georgi
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  9. Brianna
    Brianna avatar
    5 posts
    Member since:
    Sep 2017

    Posted 24 Jul 2019 Link to this post

    I was having the same issue with 2019 R2, and did not have the issue with the previous version used, 2018 R3 SP1.

    I had a template column, as designed below, with the Title from the ViewBag. Casting ViewBag.DisplayNameTitle to a string fixed the StackOverflowException.

    c.Template(e => e.DisplayName)
        .Title(ViewBag.DisplayNameTitle)
        .ClientTemplate(
            "<span " +
                "#if(IsDeleted) {#" +
                    "style=\"text-decoration:line-through; color:red;\" " +
                "#}#" +
            ">#=DisplayName#</span>");
  10. Brianna
    Brianna avatar
    5 posts
    Member since:
    Sep 2017

    Posted 24 Jul 2019 in reply to Brianna Link to this post

    I should note, I am using ASP.NET MVC, not .NET Core.
  11. Georgi
    Admin
    Georgi avatar
    685 posts

    Posted 26 Jul 2019 Link to this post

    Hello Brianna,

    Is casting the value from the view bag not an option for you?

    Have you considered including this data to the viewmodel of the current page?


    Regards,
    Georgi
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  12. Brianna
    Brianna avatar
    5 posts
    Member since:
    Sep 2017

    Posted 26 Jul 2019 in reply to Georgi Link to this post

    Casting ViewBag.DisplayNameTitle to a string fixed the StackOverflowException.
  13. Ram
    Ram avatar
    1 posts
    Member since:
    Feb 2016

    Posted 14 Sep 2019 Link to this post

    Had same issue when upgrading Kendo to 2019 R2, applying explicit casting fixed the issue.
Back to Top