Closed jrn1993 closed 1 month ago
Can you share the contents of your Counter.razor page?
Does it look like the code that is shown on the page? Because the new property is being added on this step.
Hi Katie - My Components/Pages/Counter.razor
output is below. Step titled 'Modify a component', which is different.
@page "/counter"
@rendermode InteractiveServer
<PageTitle>Counter</PageTitle>
<h1>Counter</h1>
<p role="status">Current count: @currentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
@code {
private int currentCount = 0;
public int IncrementAmount { get; set; } = 1;
private void IncrementCount()
{
currentCount++;
}
}
---
It looks like you're missing the [Parameter]
attribute above IncrementAmount
Could you try adding this?
This issue is stale because there has been no response to a request for more information for 7 days.
This issue is stale because there has been no response to a request for more information for 7 days.
@katiesavage I had noticed that your output was copy and paste image, and the week escaped me, but it was my user error. Appreciate your help and thank you!
URL
https://dotnet.microsoft.com/en-us/learn/aspnet/blazor-cli-tutorial/modify
Operating system
windows
More information about your system
Windows 11 Pro, Beta Insider Program x64
Description
C:\Users\jonat\Projects\BlazorApp\Components\Pages\Home.razor An unhandled exception occurred while processing the request. Error details below but it seems that Visual Studio is not recognizing an invalid operation reflected on the web app.
InvalidOperationException: Object of type 'BlazorApp.Components.Pages.Counter' has a property matching the name 'IncrementAmount', but it does not have [Parameter], [CascadingParameter], or any other parameter-supplying attribute. Microsoft.AspNetCore.Components.Reflection.ComponentProperties.ThrowForUnknownIncomingParameterName(Type targetType, string parameterName)
When I deleted the counter element and save the file, the web app reappears.
dotnet --info
PS C:\Users\jonat> dotnet --info .NET SDK: Version: 9.0.100-rc.1.24452.12 Commit: 81a714c6d3 Workload version: 9.0.100-manifests.67cd1eb6 MSBuild version: 17.12.0-preview-24422-09+d17ec720d
Runtime Environment: OS Name: Windows OS Version: 10.0.22635 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\9.0.100-rc.1.24452.12\
.NET workloads installed: Configured to use loose manifests when installing new manifests. [aspire] Installation Source: VS 17.12.35309.182 Manifest Version: 8.2.0/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.0\WorkloadManifest.json Install Type: FileBased
Host: Version: 9.0.0-rc.1.24431.7 Architecture: x64 Commit: static
.NET SDKs installed: 8.0.304 [C:\Program Files\dotnet\sdk] 8.0.402 [C:\Program Files\dotnet\sdk] 9.0.100-rc.1.24452.12 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 9.0.0-rc.1.24452.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 9.0.0-preview.6.24327.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 9.0.0-rc.1.24431.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 9.0.0-rc.1.24452.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables: Not set