toddams / RazorLight

Template engine based on Microsoft's Razor parsing engine for .NET Core
Apache License 2.0
1.51k stars 260 forks source link

@Model.myVar when it is followed by another char #321

Closed zevero closed 4 years ago

zevero commented 4 years ago

Describe the bug

@Model.lenghtInM
works
@Model.lenghtInM m
works as well but
@Model.lengthInMm
naturally does not. This is a contrived example, but I need to have my var adjacent to other text. **To Reproduce** Look at the examples, look at the docs. There is no example given with syntax similar to
@(Model.lengthInM)m
(does not work) I also tried @Raw(Model.lenghtInM)m but got an error as well **Expected behavior** I expect to find an alternative syntax in docs, maybe with an example **Information (please complete the following information):** - Windows 10 Enterprise 1909 - .NET Core 2.1 , etc - RazorLight version [2.0.0-beta4 - OFFICIAL RazorLight package https://www.nuget.org/packages/razorlight - Visual Studio 2019
jzabroski commented 4 years ago

Is this a RazorLight bug, or a general Razor bug?

jzabroski commented 4 years ago

@zevero Need more details. What error are you getting? Cannot reproduce.

namespace RazorLight.Tests.Models
{
    public class MetricLengthsTestViewModel
    {
        public long LengthInM { get; set; }
        public long LengthInMm { get; set; }
    }
}
@using RazorLight
@inherits TemplatePage<RazorLight.Tests.Models.MetricLengthsTestViewModel>

<p>@Model.LengthInMm</p>
<p>@Model.LengthInM</p>

I then commented out LengthInMm and then patched the first line to be:

@using RazorLight
@inherits TemplatePage<RazorLight.Tests.Models.MetricLengthsTestViewModel>

<p>@(Model.LengthInM)m</p>
<p>@Model.LengthInM</p>

And still have no errors.