{"record":{"id":"dae09a1338998cbc","repo":"dotnet/aspnetcore","slug":"the-type-targettype-fullname-declares-more-tha","errorCode":null,"errorMessage":"The type '{targetType.FullName}' declares more than one parameter matching the name '{propertyName.ToLowerInvariant()}'. Parameter names are case-insensitive and must be unique.","messagePattern":"The type '(.+?)' declares more than one parameter matching the name '(.+?)'\\. Parameter names are case-insensitive and must be unique\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Components/Components/src/Reflection/ComponentProperties.cs","lineNumber":333,"sourceCode":"                    continue;\n                }\n\n                var propertyName = propertyInfo.Name;\n                if (parameterAttribute != null && (propertyInfo.SetMethod == null || !propertyInfo.SetMethod.IsPublic))\n                {\n                    throw new InvalidOperationException(\n                        $\"The type '{targetType.FullName}' declares a parameter matching the name '{propertyName}' that is not public. Parameters must be public.\");\n                }\n\n                var propertySetter = new PropertySetter(targetType, propertyInfo)\n                {\n                    AcceptsDirectParameters = acceptsDirectParameters,\n                    AcceptsCascadingParameters = acceptsCascadingParameters,\n                };\n\n                if (_underlyingWriters.ContainsKey(propertyName))\n                {\n                    throw new InvalidOperationException(\n                        $\"The type '{targetType.FullName}' declares more than one parameter matching the \" +\n                        $\"name '{propertyName.ToLowerInvariant()}'. Parameter names are case-insensitive and must be unique.\");\n                }\n\n                _underlyingWriters.Add(propertyName, propertySetter);\n\n                if (parameterAttribute != null && parameterAttribute.CaptureUnmatchedValues)\n                {\n                    // This is an \"Extra\" parameter.\n                    //\n                    // There should only be one of these.\n                    if (CaptureUnmatchedValuesWriter != null)\n                    {\n                        ThrowForMultipleCaptureUnmatchedValuesParameters(targetType);\n                    }\n\n                    // It must be able to hold a Dictionary<string, object> since that's what we create.\n                    if (!propertyInfo.PropertyType.IsAssignableFrom(typeof(Dictionary<string, object>)))","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/294cab2f9b2e03af6b953820c7ab497c3c8b7ad9/src/Components/Components/src/Reflection/ComponentProperties.cs#L315-L351","documentation":"Blazor component parameter names are matched case-insensitively. When the framework builds the parameter cache for a component type, it detects that two properties decorated with [Parameter] or [CascadingParameter] resolve to the same lowercased name and throws InvalidOperationException. This is a design-time correctness check that prevents ambiguous parameter binding at runtime.","triggerScenarios":"A component declares two parameter properties whose names differ only by case (e.g., [Parameter] public string? Title and [Parameter] public string? title). Also triggered when a derived component redeclares a [Parameter] that already exists on a base component with different casing, or when an explicitly implemented interface property collides with a declared parameter name.","commonSituations":"Copy-pasting a property and renaming with different casing; inheriting from a base component that already declares a similarly-named parameter; refactoring a property name and accidentally leaving the old casing behind; VB.NET interop where case-insensitivity is the norm but clashes with Blazor's own case-insensitive matching.","solutions":["Inspect the component type named in the error and search for [Parameter] or [CascadingParameter] properties that differ only by case.","Check all base classes of the component type for parameters whose names collide case-insensitively with the derived class's parameters.","Rename one of the colliding properties to a distinct name and update all usages in markup (.razor files) and C# code.","If using [CascadingParameter] alongside [Parameter] for the same property, combine them on a single property declaration."],"exampleFix":"// before\n[Parameter] public string? Title { get; set; }\n[Parameter] public string? title { get; set; } // collides\n\n// after\n[Parameter] public string? Title { get; set; }\n[Parameter] public string? Subtitle { get; set; }","handlingStrategy":"validation","validationCode":"// Validate before component registration\nstatic void ValidateNoDuplicateParameterNames(Type componentType)\n{\n    var seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase);\n    foreach (var prop in componentType.GetProperties(\n        BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance))\n    {\n        var hasParam = prop.GetCustomAttribute<ParameterAttribute>() != null\n            || prop.GetCustomAttribute<CascadingParameterAttribute>() != null;\n        if (!hasParam) continue;\n        if (!seen.Add(prop.Name))\n            throw new InvalidOperationException(\n                $\"Duplicate parameter '{prop.Name}' on {componentType.FullName}\");\n    }\n}\n// Call: ValidateNoDuplicateParameterNames(typeof(MyComponent));","typeGuard":"// Compile-time guard via generic constraint is not possible for attribute-based params.\n// Use a Roslyn analyzer or source generator to detect duplicate [Parameter] names at build time.","tryCatchPattern":null,"preventionTips":["Use a Roslyn analyzer to flag duplicate case-insensitive [Parameter] names at compile time.","Establish a naming convention for parameters (PascalCase) and avoid partial-case variants.","During code reviews, check that renamed parameters have no leftover casing-different duplicates.","Run a startup validation pass over all registered component types in test fixtures."],"tags":["blazor","component","parameters","naming","case-insensitive"],"analyzedSha":"294cab2f9b2e03af6b953820c7ab497c3c8b7ad9","analyzedAt":"2026-08-06T20:08:02.189Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}