-
Notifications
You must be signed in to change notification settings - Fork 2.1k
RazorViewEngineOptions.ParseOptions are hard to use #6009
Comments
ref return |
IMO we should not support/expose this at all. It's confusing and we don't really do what it says. Here are all 20 reasons why:
|
@davidfowl who asked for this feature. I think you're right - we should probably have a select set of things exposed on view engine options (additional references for instance). We could have extensibility \ replacability around things like |
@Eilon @davidfowl @DamianEdwards - my proposal is to remove this from options and try to remove this from the startup path unless you actually need it. I think this is a holdover from DNX days. |
@rynowak where did we land on this? |
I haven't started this yet. If you think you can get it done today that would be a load of of my mind 👍 |
Sure, I can take over this. |
Trying to set the C# lang version that Razor uses via the
RazorViewEngineOptions.ParseOptions
is a less-than-optimal experience right now, as the Roslyn types are immutable.The following doesn't compile as
ParseOptions.LanguageVersion
is not settable:The IntelliSense leads you down a path where this looks like what you should do, but it doesn't work, because
WithLanguageVersion
returns a new instance ofParseOptions
which gets lost to the ether:This is actually what you need to do:
Or probably more correctly:
Not really sure we can do anything about this given the types are designed this way.
The text was updated successfully, but these errors were encountered: