I'm using Visual Studio 2015 to develop a website using web forms and Visual Basic. My problem is the error BC36645 has occured, preventing me from building the solution. It is described as "Data type(s) of the type parameter(s) in method 'Public Shared Overloads Function FromResult(Of TResult)(result As TResult) As Task(Of TResult)' cannot be inferred from these arguments. Specifying the data type(s) explicitly might correct this error."
Which I understand the basic meaning of. However, it's stated to be in a file that I have not touched, it's autogenerated. The file is IdentityModels.vb located in the Models folder.
I got the same error in another project in the same solution, which I solved by deleting, re-creating the project and rebuilding. But this is not really a convenient way to solve the problem.
Does someone have the same problem, can explain what it is about, or even have a proper solution?
//Eva-Lotta
EDIT:
This is the contents of the file the error points to (with the error in " Return Task.FromResult(GenerateUserIdentity(manager))":
Imports System
Imports System.Threading.Tasks
Imports System.Security.Claims
Imports Microsoft.AspNet.Identity
Imports Microsoft.AspNet.Identity.EntityFramework
Imports Microsoft.AspNet.Identity.Owin
Imports Microsoft.Owin.Security
Public Class ApplicationUser
Inherits IdentityUser
Public Function GenerateUserIdentity(manager As ApplicationUserManager) As
Dim userIdentity = manager.CreateIdentity(Me, DefaultAuthenticationTypes.ApplicationCookie)
Return userIdentity
End Function
Public Function GenerateUserIdentityAsync(manager As ApplicationUserManager)
As Task(Of ClaimsIdentity)
Return Task.FromResult(GenerateUserIdentity(manager))
End Function
End Class
Public Class ApplicationDbContext
Inherits IdentityDbContext(Of ApplicationUser)
Public Sub New()
MyBase.New("DefaultConnection", throwIfV1Schema:=False)
End Sub
Public Shared Function Create As ApplicationDbContext
Return New ApplicationDbContext()
End Function
End Class
#Region "Helpers"
Public Class
Public Const XsrfKey As String = "xsrfKey"
Public Const ProviderNameKey As String = "providerName"
Public Shared Function GetProviderNameFromRequest(request As HttpRequest) As String
Return request.QueryString(ProviderNameKey)
End Function
Public Const CodeKey As String = "code"
Public Shared Function GetCodeFromRequest(request As HttpRequest) As String
Return request.QueryString(CodeKey)
End Function
Public Const UserIdKey As String = "userId"
Public Shared Function GetUserIdFromRequest(request As HttpRequest) As String
Return HttpUtility.UrlDecode(request.QueryString(UserIdKey))
End Function
Public Shared Function GetResetPasswordRedirectUrl(code As String, request As HttpRequest) As String
Dim absoluteUri = "/Account/ResetPassword?" + CodeKey + "=" + HttpUtility.UrlEncode(code)
Return New Uri(request.Url, absoluteUri).AbsoluteUri.ToString()
End Function
Public Shared Function GetUserConfirmationRedirectUrl(code As String, userId As String, request As HttpRequest) As String
Dim absoluteUri = "/Account/Confirm?" + CodeKey + "=" + HttpUtility.UrlEncode(code) + "&" + UserIdKey + "=" + HttpUtility.UrlEncode(userId)
Return New Uri(request.Url, absoluteUri).AbsoluteUri.ToString()
End Function
Private Shared Function IsLocalUrl(url As String) As Boolean
Return Not String.IsNullOrEmpty(url) AndAlso ((url(0) = "/"c AndAlso (url.Length = 1 OrElse (url(1) <> "/"c AndAlso url(1) <> "\"c))) OrElse (url.Length > 1 AndAlso url(0) = "~"c AndAlso url(1) = "/"c))
End Function
Public Shared Sub RedirectToReturnUrl(returnUrl As String, response As HttpResponse)
If Not [String].IsNullOrEmpty(returnUrl) AndAlso IsLocalUrl(returnUrl) Then
response.Redirect(returnUrl)
Else
response.Redirect("~/")
End If
End Sub
End Class
#End Region
To resolve this error You may be able to specify a data type for the type parameter or parameters instead of relying on type inference.