Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Fixing an ambiguous refrerence

$
0
0

Hi, 

Overview

To learn ASP.NET Core I decided to come up with a sample learning project for managing 'Tasks'.  The name of my project is 'AspNetCore1Lab' mentioned in the error below.  I created my db and reverse engineered using the EF7 docs.   However, when I did and ran my project I realized that because I named one of my database tables 'Task' it didn't like it because of the ambiguous reference with the full error message below.

The error that tipped me off was "ASPV__Views_Home_Index_cshtml.ExecuteAsync()': return type must be 'Task' to match overridden member 'RazorPage.ExecuteAsync()'"

I renamed my database tables so they wouldn't be reserved words and it ran fine after.  However, I guess my question is if there was a way to fully qualify the Async Task below somewhere to fix the error?  

Full error message

The return type of an async method must be void, Task or Task<T>
[Microsoft.AspNet.Mvc.Razor.Internal.RazorInjectAttribute]
public Microsoft.AspNet.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
#line hidden
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
__tagHelperRunner = __tagHelperRunner ?? new Microsoft.AspNet.Razor.Runtime.TagHelpers.TagHelperRunner();
#line 1 "/Views/Home/Index.cshtml"
ViewData["Title"] = "Home Page";

'Task' is an ambiguous reference between 'AspNetCore1Lab.Models.Task' and 'System.Threading.Tasks.Task'
[Microsoft.AspNet.Mvc.Razor.Internal.RazorInjectAttribute]
public Microsoft.AspNet.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
#line hidden
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
__tagHelperRunner = __tagHelperRunner ?? new Microsoft.AspNet.Razor.Runtime.TagHelpers.TagHelperRunner();
#line 1 "/Views/Home/Index.cshtml"
ViewData["Title"] = "Home Page";

'ASPV__Views_Home_Index_cshtml.ExecuteAsync()': return type must be 'Task' to match overridden member 'RazorPage.ExecuteAsync()'
[Microsoft.AspNet.Mvc.Razor.Internal.RazorInjectAttribute]
public Microsoft.AspNet.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
#line hidden
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
__tagHelperRunner = __tagHelperRunner ?? new Microsoft.AspNet.Razor.Runtime.TagHelpers.TagHelperRunner();
#line 1 "/Views/Home/Index.cshtml"
ViewData["Title"] = "Home Page";

'ASPV__Views_Home_Index_cshtml.ExecuteAsync()': not all code paths return a value
[Microsoft.AspNet.Mvc.Razor.Internal.RazorInjectAttribute]
public Microsoft.AspNet.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
#line hidden
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
__tagHelperRunner = __tagHelperRunner ?? new Microsoft.AspNet.Razor.Runtime.TagHelpers.TagHelperRunner();
#line 1 "/Views/Home/Index.cshtml"
ViewData["Title"] = "Home Page";


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>