Closed juner closed 2 years ago
After converting Index.razor
, it looks like this:
Index.razor.g.cs
// Other stuff
#line default
#line hidden
#nullable disable
[Microsoft.AspNetCore.Components.RouteAttribute("/")]
public partial class Index : Microsoft.AspNetCore.Components.ComponentBase
{
#pragma warning disable 1998
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
__builder.AddMarkupContent(0, "<h1>Hello, world!</h1>\r\n\r\n");
__builder.OpenComponent<WebApplication.Pages.Component>(1);
__builder.AddAttribute(2, "ObsoleteValue", "hello");
__builder.AddAttribute(3, "Value", "world");
__builder.CloseComponent();
}
#pragma warning restore 1998
}
}
#pragma warning restore 1591
// Other stuff
So shouldn't we do the following?
__builder.AddAttribute(2, nameof(WebApplication.Pages.Component.ObsoleteValue), "hello");
__builder.AddAttribute(3, nameof(WebApplication.Pages.Component.Value), "world");
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Thanks, closing as duplicate of https://github.com/dotnet/aspnetcore/issues/32206.
Describe the bug
If it is described in razor tag notation, no compile error will occur even if the obsolete attribute is specified.
(use TreatWarningsAsErrors=true)
To Reproduce
Directory.Build.props
Component.razor
use
Index.razor
no error
For reference, I have prepared a console project with a similar configuration. ConsoleApp
Further technical details
dotnet --info
dotnet --info