Description
Issue: In a Razor Component any variables named "Microsoft" reproduce the error (variable type on the error message changes accordingly):
Error CS1061 'string' does not contain a definition for 'AspNetCore' and no accessible extension method 'AspNetCore' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
Question: Is this an issue or by design?
Project details and files: This is a Razor Class Library project.
.csproj
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
<LangVersion>8</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.1.1" />
</ItemGroup>
</Project>
LoginFormUserComponent.razor
@using SBL.Models.User.Login.OpenId
<div class="login">
<div class="page-title">
Login
</div>
<p>
To login you must use one of the available Social Login options below:
</p>
<div class="social-login__container">
<SocialButtonLoginComponent Provider="@Facebook" Image="/images/social/brands/facebook_37x37.png" />
<SocialButtonLoginComponent Provider="@Google" Image="/images/social/brands/google_37x37.png" />
@*<SocialButtonLoginComponent Provider="@Microsoft" Image="/images/social/brands/microsoft_37x37.png" />*@
<SocialButtonLoginComponent Provider="@Twitter" Image="/images/social/brands/twitter_37x37.png" />
</div>
</div>
@code {
[Parameter]
public ProviderOpenIdModel? Facebook { get; set; } = null;
[Parameter]
public ProviderOpenIdModel? Google { get; set; } = null;
//[Parameter]
//public ProviderOpenIdModel? Microsoft { get; set; } = null; // ERROR
[Parameter]
public ProviderOpenIdModel? Twitter { get; set; } = null;
public string Microsoft { get; set; } // ERROR
}
Comments:
I started getting this random error and found out that apparently I cannot write "Microsoft" as a variable name in a Razor component.
I was unable to find the search keywords for anything similar to this.
I initially thought that there was a reference issue on my project when I realized the commented parameter was the issue. I then tried using a native variable type to see if the issue persisted - and it did.
It's not really an issue I need fixing per say - just wondering why this happens.
Thanks in advance!