This project is read-only.
1

Resolved

0.7.4052301 Can't Emit C# 6

description

I suppose for now that this is a bug.

The 0.6.4033103 dlls emit code containing C# 6.0 features fine, but 0.7.4052301 shows diagnostic errors.

Details:
https://roslyn.codeplex.com/discussions/549287

comments

sruppr wrote Jun 21, 2014 at 7:23 PM

Workaround:

The issue is that the newer version seems to treat LanguageVersion.CSharp6 as LanguageVersion.CSharp5. One workaround is to specify a parse option with the language version set to LanguageVersion.Experimental.
public static partial class RoslynExtension {
    public static Project WithExperimentalParseOptions(this Project project) {
                return project.WithParseOptions(project.ParseOptions.ToExperimental());
    }
    public static CSharpParseOptions ToExperimental(this ParseOptions options) {
        return new CSharpParseOptions(
           LanguageVersion.Experimental,
           options.DocumentationMode,
           options.Kind,
           options.PreprocessorSymbolNames.ToArray()
        );
    }
}
The Project returned by WithExperimentalParseOptions will not raise diagnostic errors for currently implemented C# 6.0 features.

VSadov wrote Jul 24, 2014 at 6:11 PM

Features that may undergo design changes, possibly based on the customer feedback light up only under "experimental".
Once the design is considered solid enough, they will be moved to C#6.0