Converter crashing

5 posts, 0 answers
  1. CD
    CD avatar
    13 posts
    Member since:
    May 2011

    Posted 29 Aug 2011 Link to this post

    Converter is crashing when trying to convert Telerik code from MVC Grid Demo, SessionProductRepository object

    public static IList<EditableProduct> All()
    IList<EditableProduct> result =
    if (result == null)
    HttpContext.Current.Session["Products"] = result =
    (from product in new NorthwindDataContext().Products
    select new EditableProduct
    ProductID = product.ProductID,
    ProductName = product.ProductName,
    UnitPrice = product.UnitPrice.HasValue ? product.UnitPrice.Value : default(decimal),
    UnitsInStock = product.UnitsInStock.HasValue ? product.UnitsInStock.Value : default(int),
    Discontinued = product.Discontinued,
    LastSupply = DateTime.Today
    return result;

  2. Todd
    Todd avatar
    66 posts

    Posted 30 Aug 2011 Link to this post

    Hi Cd,

    Thanks for reporting the issue. Unfortunately, the current version of NRefactory that powers the Telerik Converter has some trouble with the LINQ expression syntax. We will research the availability of updates to the open source NRefactory that make be able to address this. In the mean time, the Converter will not be able to convert this specific syntax.

    In the meantime, you might try this other online converter which seems to have some support for LINQ syntax conversion:

    I hope that helps!

  3. Sebastian
    Sebastian avatar
    10 posts
    Member since:
    Sep 2011

    Posted 15 Sep 2011 Link to this post


    Is there a work around this one?

    Thank you,
  4. Darren
    Darren avatar
    36 posts
    Member since:
    Jan 2008

    Posted 20 Sep 2011 Link to this post

    I have same issue. But fortunately, Linq syntax in C# and in VB are the same. So you just need to remove the Linq statement and convert, then put the Linq statement back.
  5. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 20 Oct 2011 Link to this post

    Thanks for sharing the workaround, Darren. Hopefully this helps others.

    I don't think all LINQ syntax is 100% mappable from VB to C#, but hopefully this help get more of your code easily converted.

Back to Top