dotnet / dotnet/Scaffolding

Deference of a possible null reference

Open
#2,069 2 comments 0 reactions 1 assignee Claimed by @deepchoudhery View on GitHub
area-identity area-scaffolding
Dominant language
C#
Stars
818
Forks
260
Avg merge
1d 8h
Merged PRs (30d)
10

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

Adding a scaffolding identity to my project creates this warning error CS8602 Deference of a possible null reference.
I am using VS2022 with sqlserver mgnt studio v18.12.1
Where do I put the '?' or set it to =!null.
I am following the turorial. This is the link: https://www.youtube.com/watch?v=HSP6EZ5i9RY

### Expected Behavior

There should be no warning error. Should load the page as indicated in the youtube tutorial

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .NET Version

_No response_

### Anything else?

@model LogoutModel
@{
ViewData["Title"] = "Log out";
}

@ViewData["Title"]


@{
if (User.Identity.IsAuthenticated) //Warning message at this point
{

Click here to Logout

}
else
{

You have successfully logged out of the application.


}
}

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.