RickStrahl / Westwind.RazorHosting

Hosting the Razor Runtime outside of ASP.NET/MVC for use in non-Web .NET applications.
144 stars 32 forks source link

Fix #17 and Fix #7 #25

Closed kgiszewski closed 6 years ago

kgiszewski commented 6 years ago

Fixes #7 and #17 despite being closed :)

Won't bother me if you think this isn't worthy but seems more than just I have hit this issue.

By default this should not be a breaking change, it allows the dev to use a a different style based on config.

RickStrahl commented 6 years ago

Did you actually see the code fail before the fix? The changes I made should be able to catch both sets of line endings.

Using a fixed setting isn't going to work in all cases it's perfectly possible to have both \n and \r\n in a document, so the old code just looks for \n and then trims which will trim out the \r which is what that code is trying to accomplish (ie. essentially read the single @model line).

kgiszewski commented 6 years ago

Yes the code as-is fails which brought me to the source.

kgiszewski commented 6 years ago

The string replace workaround is what I'm using now but feels a bit hacky.

kgiszewski commented 6 years ago

I just noticed 3.3 was released a few days ago. I was testing against 3.2.

https://github.com/RickStrahl/Westwind.RazorHosting/commit/47450a490f1f5a6693926ab7f8f90f5d3640a367

I think the above commit might be the fix I needed. Sorry to bother you 😁