I want to experiment with the potential C# 7 future language features.
I have a virtual machine into which I have downloaded the Roslyn codebase (features/patterns branch) and built as described on Roslyn's github here: Building and Testing on Windows.
I can successfully fire up a new experimental instance of Visual Studio (set VisualStudioSetup as the startup project and run).
When I try out the new language features (pattern matching and local functions) I get an error in the editor as a squiggly and also error when I build:
Error CS8058 Feature 'local functions' is experimental and unsupported; use '/features:localFunctions' to enable.
Error CS8058 Feature 'pattern matching' is experimental and unsupported; use '/features:patterns' to enable.
Where do I put these options?
I tried adding it to the command line arguments, but I get an error.
This is bug 7812 that I haven't fixed yet. Sorry.
Internally, the compiler team mostly just tests things through unit tests or the command line compiler; if we really need to test the IDE we just delete the check that's passing in the feature flag.
Sorry, I haven't done R&D with the said code you have downloaded.
But in Visual Studio '15' preview (announced on 30 March 2016) I have fixed this very easily. It might help other people.
I was getting the error
Error CS8058 Feature 'local functions' is experimental and unsupported; use '/features:localFunctions' to enable.
To fix this select your project name and right click >> Properties Window >> Build and then add the below two options in "Conditional Compilation symbols" text box __DEMO__,__DEMO_EXPERIMENTAL__
click on save button to Save it. Now build your application and your build will be succeeded.
Even though at my end if I add any one of the __DEMO__ & __DEMO_EXPERIMENTAL__ then it is working fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With