General Feedback

How can we test the new C# 8.0/Experimental features?

Started by BKStrelioff on 6,468 views

In particular, the nullable support. ReSharper allows specification of language version per-project, is there anything similar for NCrunch (and for a better experience support for a solution-wide default that can be overridden for particular projects were needed)?

There is also command-line support (documented as "csc.exe -langversion:7.2 Legacy.cs"), but I'm not sure if we can specify 8.0 with NCrunch.

Thanks.
Hi,

NCrunch sits atop the build system, so it will use whatever MSBuild does. The version of MSBuild used by NCrunch is that same as the one installed in the instance of Visual Studio you're using (i.e. C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin).

This means that if you convert your projects to use C# 8.0, NCrunch should automatically follow the same settings. If there is a -langversion compiler parameter to do this, then specifying it inside your build settings for each project will be applicable to both VS builds and NCrunch builds.

Note that to my knowledge, NCrunch's feature-set hasn't been tested with C# 8.0. I don't expect problems, but if you see weird things happening please do report them.
I did see some problems after I installed the C# 8.0 preview ( https://roslyninfra.blob.core.windows.net/compilers/nonnull/Roslyn_Nullable_References_Preview_11152017.zip )

While MSBuild and ReSharper parsed (with warning, but no errors) interface return type specifications such as

Assembly ? WaitForLoadCompletion ( );

NCrunch 3.12.0.15 reported compilation errors (The type 'Assembly' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method 'Nullable<T>') along with the "failed to build" chain reaction.

NOTE: I tried to copy & paste the text from the NCrunch Tests window to show the full text, but that caused VS2017 Enterprise Preview to crash and restart.

I understand this is early prototype Roslyn code, so I'm not sure how much support NCrunch can provide. But if anyone can find a way for NCrunch to successfully build projects (test and non-test) using C# 8.0, please post a sample solution that uses the new nullable support.

Thanks.
Hi,

Thanks for your posts. I installed the nullable reference preview into the visual studio preview. When building a project that uses the new features inside of visual studio it works. Building the same project from the commandline using msbuild doesn't work. You mentioned you used msbuild, did you do that from inside visual studio or from the commandline? If I open the visual studio command prompt and run msbuild on a test project, it fails with the same error message as NCrunch. NCrunch uses msbuild to build the software.

I've looked into how the preview is installed. It doesn't seem to make any changes to msbuild. (That I can detect) I think that will come later in the process. Until that is the case, it's very hard to support.

If you can build a project that uses nullable references using msbuild from the CLI, can you explain what steps you took?
This post has been deleted.

Post a reply

Log in to reply.