Quoting from Visual Studio 2017 RC Release Notes
Language Extensions and Analyzers
This release includes some proposed new langua
There is nothing else you need to do to enable task-like returns. The issue here is that the diagonstic message for this feature hasn't been updated yet. Here is a link to the tracking issue:
https://github.com/dotnet/roslyn/issues/12621
The TasklikeAttribute
attribute name turns out isn't what's implemented in VS2017 RC, that's from a different version of the proposal. What's actually implemented relies on a type System.Runtime.CompilerServices.AsyncMethodBuilderAttribute
, which appears to work exactly the same way.
I was not able to find this documented, but I was able to find this in the Roslyn tests, for example CodeGenAsyncTests.cs:
[AsyncMethodBuilder(typeof(ValueTaskMethodBuilder))] struct ValueTask { } ... namespace System.Runtime.CompilerServices { class AsyncMethodBuilderAttribute : System.Attribute { public AsyncMethodBuilderAttribute(System.Type t) { } } }