Async Task stopped working

I don't need any c# coding help here, just a question.

I have a simple email send page that was working fine. Now it is generating an error.

dotnet: c:\PowerMoto\server\Pages\AddEmails.razor.cs(16,28): error CS1983: The return type of an async method must be void, Task, Task, a task-like type, IAsyncEnumerable, or IAsyncEnumerator [c:\PowerMoto\server\PowerMoto.csproj]

Has something changed in Radzen that would stop this from working?

This is a C# compilation error unrelated to Radzen. And it seems to be a custom method which you have created.

Yes it's a custom method. I am unable to create any method using async Task (which was working)

Just checking to see if you can duplicate.

Check if you have a class called Task in your application (or a page called Task). You probably do as I see an AddTask.razor file. If this is the case change Task to System.Threading.Tasks.Task in your method.

Ok, I'm just stupid...I keep running into this kind of things with naming conventions...

Thanks for pointing it out.

This is not naming conventions - there is a class called Task in the PowerMoto.Pages namespace which takes precedence over System.Threading.Tasks.Task. Hence the C# compiler picks it up when it sees Task. Fully qualifying is required to remove the ambiguity.

To be honest I logged this as an issue in the Blazor repo but it was closed as by design :slight_smile: I suspected people would create pages that clash with built-in .NET types - Task, String etc. was accidentally created as I have a table called tasks and I accidentally built a crud page against it. I realized I need to watch that more closely, as I have done this before.

Thank you for the response!