Namespace cannot directly contain members Error [Answered]
@model SharedProject.Models.Api.WeatherEndpoint.WeatherResponse?
@inject IStringLocalizer<SharedResource> SharedLocalizer
@using SharedProject.Localization
@using BWASM.Pages
@using Microsoft.AspNetCore.Mvc.TagHelpers
@using Microsoft.Extensions.Localization
@{ViewData["Title"] = "Home Page";}
<div class="text-center">
<h1 class="display-4">@SharedLocalizer["Hello"] @GetUsername()</h1>
<component type="typeof(Counter)" render-mode="WebAssemblyPrerendered"/>
<p>Weather Forecasts: @Model?.Forecasts.Count</p>
<component type="typeof(Faq)" render-mode="WebAssemblyPrerendered" headerText="All claims" desc="@AllClaims"/>
<component type="typeof(Faq)" render-mode="WebAssemblyPrerendered" headerText="User Claims" desc="@UserClaims"/>
<component type="typeof(Faq)" render-mode="WebAssemblyPrerendered" headerText="Token Claims" desc="@TokenClaims"/><
/div>
@{
private readonly List<string> _userClaimTypes = new() {
};
private readonly List<string> _tokenClaimTypes = new() {
};
private Dictionary<string, string> UserClaims => User.Claims.Where(x => _userClaimTypes.Contains(x.Type)).ToDictionary(c
=> c.Type, c => c.Value);
private Dictionary<string, string> TokenClaims => User.Claims.Where(x =>
_tokenClaimTypes.Contains(x.Type)).ToDictionary(c => c.Type, c => c.Value);
private Dictionary<string, string> AllClaims => User.Claims.ToDictionary(c => c.Type, c => c.Value);
string GetUsername() {
string? username = ViewData["Username"]?.ToString();
return string.IsNullOrEmpty(username) ? "New User" : username;
}
}@model SharedProject.Models.Api.WeatherEndpoint.WeatherResponse?
@inject IStringLocalizer<SharedResource> SharedLocalizer
@using SharedProject.Localization
@using BWASM.Pages
@using Microsoft.AspNetCore.Mvc.TagHelpers
@using Microsoft.Extensions.Localization
@{ViewData["Title"] = "Home Page";}
<div class="text-center">
<h1 class="display-4">@SharedLocalizer["Hello"] @GetUsername()</h1>
<component type="typeof(Counter)" render-mode="WebAssemblyPrerendered"/>
<p>Weather Forecasts: @Model?.Forecasts.Count</p>
<component type="typeof(Faq)" render-mode="WebAssemblyPrerendered" headerText="All claims" desc="@AllClaims"/>
<component type="typeof(Faq)" render-mode="WebAssemblyPrerendered" headerText="User Claims" desc="@UserClaims"/>
<component type="typeof(Faq)" render-mode="WebAssemblyPrerendered" headerText="Token Claims" desc="@TokenClaims"/><
/div>
@{
private readonly List<string> _userClaimTypes = new() {
};
private readonly List<string> _tokenClaimTypes = new() {
};
private Dictionary<string, string> UserClaims => User.Claims.Where(x => _userClaimTypes.Contains(x.Type)).ToDictionary(c
=> c.Type, c => c.Value);
private Dictionary<string, string> TokenClaims => User.Claims.Where(x =>
_tokenClaimTypes.Contains(x.Type)).ToDictionary(c => c.Type, c => c.Value);
private Dictionary<string, string> AllClaims => User.Claims.ToDictionary(c => c.Type, c => c.Value);
string GetUsername() {
string? username = ViewData["Username"]?.ToString();
return string.IsNullOrEmpty(username) ? "New User" : username;
}
}I do not understand the issue here at all? Maybe there are some invisible characters?

