CS0570 'AvailableItems.GetListAsync(string)' is not supported by the language

I am getting the message above when using a .NET Standard class recently compiled with Visual Studio 2017 15.8.9 and with the Advanced Build Settings, Language version set to C# latest minor version.

The method definition is: public async Task> GetListAsync(String filter)

I tried enabling the Use experimental Roslyn assemblies which says Current Version 2.9.0.0 (up to date) but since that did not resolve the issue I am guessing that is not what I needed to enable. Is there a way to get support for my return of a ValueTuple? This works in Visual Studio and with my unit tests that call it for testing purposes.

Thank you in advance.

Comments

  • I created a new .NET Standard project in Visual Studio with language version set to C# latest minor, and modified Class1.cs as follows:
    using System;
    using System.Threading.Tasks;
    
    namespace ClassLibrary15
    {
    	public class Class1
    	{
    		public async Task GetListAsync (String filter)
    		{
    			await Task.Delay (100);
    			return filter;
    		}
    	}
    }
    Then I referenced bin\Debug\netstandard2.0\ClassLibrary15.sll from LINQPad, and ran the following query:

    new Class1().GetListAsync("test")

    It ran without error in LINQPad 5.31 and also LINQPad 5.36.

    Is there anything else I need to do to reproduce this?
  • Your class and method do work just fine. I think it has to do with ValueTuple being returned by my method.

    using System; using System.Collections.Generic; using System.Threading.Tasks; namespace ClassLibrary1 { public class Class1 { public async Task> GetListAsync(String filter) { await Task.Delay(100); List<(String Description, String Code)> list = new List<(String Description, String Code)>(); list.Add(new System.ValueTuple("Test", "Code")); return list; } public async Task GetListAsync2(String filter) { await Task.Delay(100); return filter; } } } }

    This was in a .NET Standard 2.0 Class built in release mode.

    Note that this same code runs in a Program in LINQPad, it just does not run when I build the class with VS 2017 and then reference that dll from LINQPad and try calling GetListAsync. Not sure it helps or not but I also noticed today that the autocompletion in LINQPad doesn't show the GetListAsync method returning the ValueTuple when I dot into the object either. The GetListAsync2 does show up in autocompletion. I am using LINQPad 5.36.03

    Thank you for looking into this and let me know if I can be of more assistance.
  • I'm experiencing the same thing. Apparently it's because the method in the .NET Standard assembly is returning a value tuple (or in my case, an array of value tuple).
  • I can confirm this is still an issue with code compiled in Visual Studio 2019 16.2.1, and the LINQPad beta 5.40.00.
  • I am currently working around this by invoking the method via reflection, and casting within the LINQPad query to an array of value tuples.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!