0
votes

Below block of code is from Blazor documentation. @bind attribute throwing exception. I am trying to understand how data binding works. What I am missing in blow block of code?

@page "/test"

<input @bind="CurrentValue" />

@code {
    private string CurrentValue { get; set; }
}

Exception: enter image description here

1
The code you show here should not cause this error. Restart Visual Studio and reproduce this in a new app. - Henk Holterman
When this persists, verify you have the right SDK installed. Repair if in doubt. If you can't resolve it then add all relevant versions to the question. - Henk Holterman
@HenkHolterman I tried multiple times restarting visual studio but no luck. I will check the versions. - arjun kr
@HenkHolterman It's started working after creating new project. - arjun kr
That happens. I do regularly delete the .vs folder too, om the first signs of trouble. - Henk Holterman

1 Answers

0
votes

When you have compilation trouble with VS you don't understand

Delete bin, obj and .vs folders and rebuild using dotnet build command.

If the compilation issue persists, read carefully the stack trace and you find your error.