razor: bind:after does not compile on SDK 7.0.200
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
After installation VS2022 17.5 (SDK 7.0.200) @bind:after
is not recognized as a valid Blazor tag.
I uninstalled 17.4.5 and installed fresh 17.5
Expected Behavior
Should compile. Previous version works even with 7.0.3 (VS 17.4.5 + SDK 7.0.103)
Steps To Reproduce
- Create default WebAssembly project
- Replace content of Index.razor:
(I pasted small bind but event as code in does uppercase):
@page "/"
<input @bind="Value" @bind:after="AfterChangeEvent">
@code
{
public string Value { get; set; }
void AfterChangeEvent() {}
}
- Compile using VS or dotnet build {projectname}.csproj
Exceptions (if any)
No response
.NET Version
7.0.3
Anything else?
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 12
- Comments: 20 (9 by maintainers)
Sorry, this is indeed broken in 17.5 / 7.0.200.
The reason for this break is that between 17.4 and 17.5 the razor compiler code based moved from dotnet/razor-compiler to dotnet/razor. This move was done so the razor compiler and IDE / tooling experience could exist in a single repository. That will allow us to move together as a team, make cross cutting changes faster and overall improve the razor experience. It’s an approach we’ve had great success with in roslyn.
Unfortunately the fix for the
@bind:after
scenarios was merged into razor-compiler at the exact time we were doing the migration between the repositories. Our team got quickly consumed by cleaning up the result of merging the repositories and missed that this change was not correctly ported over. As soon as we saw this bug we realized our mistake and are working to correct it.I’m sorry for the disruption this has caused. We’ll be patching 17.5 and 7.0.2xx as soon as we can.
The PR for porting the fix is here
This breaks existing code and after 5 days it is not even triaged? really?
@jaredpar in my project it works with Visual Studio 17.5.2 and SDK 7.0.202 👍🏻
To update: I confirmed the patch made it into the upcoming 7.0.202 SDK so this issue should be resolved when that is released.
@Liero See @jaredpar’s comment above with the latest status. We’re still in a broken state right now with the get/set/after modifiers, but this will be patched shortly. We know this has been pretty painful for folks waiting on this feature, but we believe this will soon be resolved. Thank you everyone for your patience on this one!
@Bananamafia You should probably just create a new issue in the dotnet/aspnetcore repo with detailed repro steps and we’ll take a look first on the Blazor side.
I’m seeing the same; worked fine in 7.0.103. Adding a
global.json
using that SDK, got past the error for now(I created a duplicate issue, so will remove/close that issue and add my comments here)
This is important because if Microsoft pushes the latest SDK out to services like the Azure Build Service, builds will start to break.
The latest Visual Studio 2022 V17.5.0 has broken the @bind:after feature again. Previously the IntelliSense was broken in VS, but the actual dotnet build worked. However, with the latest update dotnet build (or build within Visual Studio 17.5) fails when using @bind:after as demonstrated below. See the earlier discussion: Previously closed issue 44957
@javiercn Has put together this page full of tests. These are now breaking if you copy that page into a Blazor Server app Javiers Test Repo
@danroth27 Had earlier discussed this as working from dotnet build. But I want to be clear, this is now broken when compiling using dotnet build (it is not just an intelliSense issue anymore): Dan Roth earlier discussion
Here is an example that fails in a Blazor Server project using .NET 7.
Example error:
One final question, nothing this:
Why has Microsoft got the preview label in this latest version of MSBuild that would have been installed with the Visual Studio 2022 17.5.0 update? I have not installed any preview versions of .NET or Visual Studio on this laptop.
@SteveSandersonMS Steve, maybe you could get involved and help guide the team here? This was a beautiful feature you designed for .NET 7, but we are now 3-4 months into the release cycle and the feature has gone anything but smoothly! I suggested back in November that test cases for this feature needed to be written that are run as part of the quality assurance before releasing .NET updates.