Skip to content

Conversation

filipw
Copy link
Member

@filipw filipw commented Jan 31, 2019

We can release it as a prerelease version since the latest Roslyn is available as beta on Nuget.

@filipw filipw requested a review from seesharper January 31, 2019 12:17
Copy link
Collaborator

@seesharper seesharper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

I guess the #nullable enable pragma works in scripts as well

Do we need to include <LangVersion>8.0</LangVersion> in the generated csproj file?

https://docs.microsoft.com/en-us/dotnet/csharp/tutorials/nullable-reference-types

@filipw
Copy link
Member Author

filipw commented Jan 31, 2019

#nullable should work (we can add a unit test for that though). The generated project file doesn't need to be changed (I think) since we don't use it for compilation options, only for references.

There is a new option on the CSharpCompilationOptions that controls nullable reference types, and we could set it - for example based on a command line arg? this way we can avoid #nullable

@seesharper
Copy link
Collaborator

The only issue with a command line arg is that we need to decide what to put in the launch.json file.
Anyway, it need to be opt-in. Maybe the pragma is good enough for now?

How is this on the OmniSharp side of things?

Does it show squiggles if you use the pragma? #nullable enable

@seesharper
Copy link
Collaborator

Tried with latest OmniSharp

image

What needs to be done to make this work?

@seesharper
Copy link
Collaborator

Can the language version be set in omnisharp.json ?

// this is not needed once Roslyn 3.0 stable ships
var csharpScriptCompilerType = typeof(CSharpScript).GetTypeInfo().Assembly.GetType("Microsoft.CodeAnalysis.CSharp.Scripting.CSharpScriptCompiler");
var parseOptionsField = csharpScriptCompilerType?.GetField("s_defaultOptions", BindingFlags.Static | BindingFlags.NonPublic);
parseOptionsField?.SetValue(null, new CSharpParseOptions(LanguageVersion.CSharp8, kind: SourceCodeKind.Script));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

@filipw filipw Feb 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no way to make nullable work yet because it only emits warnings and we swallow warnings at the moment. we also don't expose the ability to treat warnings as errors. I will open a separate issue to handle that

@seesharper
Copy link
Collaborator

LGTM

@seesharper seesharper merged commit acd312d into master Feb 1, 2019
@seesharper seesharper deleted the feature/roslyn-3.0.0-beta2 branch February 1, 2019 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants