Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Found markup element with unexpected name 'Cascading AuthenticationState'

I am getting this error on my App.razor:

Found markup element with unexpected name 'CascadingAuthenticationState'. If this is intended to be a component, add a @using directive for it namespace

This is the code I am using

<CascadingAuthenticationState>
    <Router AppAssembly="@typeof(Program).Assembly">
        <Found Context="routeData">
            <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
        </Found>
        <NotFound>
            <LayoutView Layout="@typeof(MainLayout)">
                <p>Sorry, there's nothing at this address.</p>
            </LayoutView>
        </NotFound>
    </Router>
</CascadingAuthenticationState>

enter image description here

I am using Visual Studio 2019 preview and I can run the application but, why do I have the red line in the Cascading....?

like image 837
Ibanez1408 Avatar asked Oct 11 '19 08:10

Ibanez1408


3 Answers

Warning! The .vs folder contains all the data that VS gathered about the projects in your solution, the opened files, debug. You will lose all that!

Close Visual Studios and delete the .vs hidden folder in the root of your solution.

Start up your project and the error's will be gone.

like image 50
pRob3 Avatar answered Nov 08 '22 13:11

pRob3


For me adding both references to _Imports.razor worked to solve same issue:

@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Authorization

enter image description here

like image 18
Konstantin Salavatov Avatar answered Nov 08 '22 12:11

Konstantin Salavatov


  1. Right Click Project
  2. Manage Nuget Packages
  3. Select "Microsoft.AspNetCore.Blazor" which you have already installed.
  4. Update with Latest stable version then...
  5. Update Latest preview again.

enter image description here

like image 4
ahmetsse Avatar answered Nov 08 '22 12:11

ahmetsse