Skip to content

Compilation error in in .NET 5 Preview 8 with attributes without value, in some cases #25267

@sjohag

Description

@sjohag

Compilation error with attributes without value, in some cases

To Reproduce

In any Razor component, add:
<video src="@videoSrc" autoplay></video>
@code{
string videoSrc = string.Empty;
}

In .NET 5 Preview 8,
error CS1503: Argument 2: cannot convert from 'string' to 'in Microsoft.AspNetCore.Components.RenderTree.RenderTreeFrame'

<video src="movie.mp4" autoplay></video>
Compiles without error

dotnet --info

.NET SDK (reflecting any global.json):
Version: 5.0.100-preview.8.20417.9
Commit: fc62663a35

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19041
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.100-preview.8.20417.9\

Host (useful for support):
Version: 5.0.0-preview.8.20407.11
Commit: bf456654f9

Metadata

Metadata

Labels

DoneThis issue has been fixedarea-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions