-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
I've got some code like this:
<a href="/image/@prevImage.ImageId" />
Which works fine. If I change it to a NavLink like this:
<NavLink href="/image/@prevImage.ImageId" />
I get a cogent error message in .Net 5.0:
RAZORGENERATE : error RZ9986: Component attributes do not support complex content (mixed C# and markup). Attribute: 'href', text: ....
This is expected, as you don't support mixed attributes with C# and markup yet.
However, in .Net 6 preview 2, if I make the same change, I get:
CSC : warning CS8785: Generator 'RazorSourceGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'AggregateException' with message 'One or more errors occurred. (Specified argument was out of the range of valid values.
Done building target "CoreCompile" in project "Damselfly.Web.csproj".
...
/Users/markotway/LocalCloud/Development/Damselfly/Damselfly.Web/Pages/_Host.cshtml(24,43,24,46): error CS0246: The type or namespace name 'App' could not be found (are you missing a using directive or an assembly reference?)
(the second 'type or namespace could not be found' error is a knock-on error from the auto-generator failing earlier, but is completely confusing).
I think this may be a regression from this issue: dotnet/roslyn#46084 (fixed here: dotnet/roslyn#46804) or may be the new .Net 6 Blazor autogenerators not having exception errors generated correctly. Either way, it's unhelpful and makes it hard to understand which code change caused the breakage.
Target framework: .Net 6.0-preview-2 (x64 using Rosetta 2, not the Arm64 version)
Operating system: osx-arm64 11.3 beta running on a MacBook Pro M1
IDE: Visual Studio for Mac v8.9 (build 409)