Aspnetcore: @using directive missing in the _Layout.cshtml after identity scaffolding

Created on 17 Sep 2019  路  8Comments  路  Source: dotnet/aspnetcore

Describe the bug

After scaffolding identity pages using serverside blazor template, "Microsoft.AspNetCore.Hosting" string appears in the html header and being rendered in the browser. @using directive missing in the _Layout.cshtml file.

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of ASP.NET Core 3.0 rc1
  2. Create new Blazor serverside app, scaffold few identity items
  3. Run project
  4. See error

Expected behavior

Environment identification should not be rendered outside of the templates

Screenshots

2019-09-17 09_38_44-- BIdentityTest

Additional context

.NET Core SDK (reflecting any global.json):
Version: 3.0.100-rc1-014190
Commit: c4d43f672d

Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100-rc1-014190\

Host (useful for support):
Version: 3.0.0-rc1-19456-20
Commit: 8f5d7b1ba4

.NET Core SDKs installed:
2.1.700 [C:\Program Files\dotnet\sdk]
2.1.800-preview-009696 [C:\Program Files\dotnet\sdk]
2.1.800 [C:\Program Files\dotnet\sdk]
3.0.100-preview8-013656 [C:\Program Files\dotnet\sdk]
3.0.100-preview9-014004 [C:\Program Files\dotnet\sdk]
3.0.100-rc1-014190 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview8.19405.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview9.19424.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-rc1.19457.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview8-28405-07 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview9-19423-09 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-rc1-19456-20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0-preview8-28405-07 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.0.0-preview9-19423-09 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.0.0-rc1-19456-20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Done area-blazor bug

All 8 comments

@HaoK wasn't this already fixed?

I think so, the latest fix for this was https://github.com/aspnet/Scaffolding/commit/0b91c37345c50b51a88a4dedf40710b1231825c6 which was merged to the release/3.0-preview9 branch, @vijayrkn what version of the scaffolding packages would have this change?

How is this related to 'Microsoft.AspNetCore.Hosting'? I thought @danroth27 was referring to a change, where a using was missed in front of that namespace?

@mkArtakMSFT thanks, I found it in the _Layout.cshtml actually, you right it's missing @using on the first line.

Ok i see the issue, this is a different instance of the same issue, I verified the fix in a private build

@HaoK to make sure I get this right, are you saying the original fix you've made also fixes this issue?
Or this there is indeed a separate fix required?

PR is https://github.com/aspnet/Scaffolding/pull/1077, there's a razor bug that needs to be workaround, based on surrounding content, sometimes the using/inject gets lost

The best long term fix is to fix the razor bug, as the behavior depends on the surrounding whitespace

Was this page helpful?
0 / 5 - 0 ratings