Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

How can we test the new C# 8.0/Experimental features?
BKStrelioff
#1 Posted : Tuesday, November 28, 2017 5:10:57 AM(UTC)
Rank: Member

Groups: Registered
Joined: 3/17/2012(UTC)
Posts: 23

Was thanked: 4 time(s) in 4 post(s)
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.
Remco
#2 Posted : Tuesday, November 28, 2017 6:14:27 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
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.
BKStrelioff
#3 Posted : Tuesday, November 28, 2017 6:57:25 AM(UTC)
Rank: Member

Groups: Registered
Joined: 3/17/2012(UTC)
Posts: 23

Was thanked: 4 time(s) in 4 post(s)
I did see some problems after I installed the C# 8.0 preview ( https://roslyninfra.blob...es_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.
michaelkroes
#4 Posted : Thursday, November 30, 2017 8:52:28 AM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 306
Location: Netherlands

Thanks: 138 times
Was thanked: 73 time(s) in 69 post(s)
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?
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.035 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download