-
Notifications
You must be signed in to change notification settings - Fork 229
Closed as not planned
Closed as not planned
Copy link
Labels
area-compilerUmbrella for all compiler issuesUmbrella for all compiler issuesbugSomething isn't workingSomething isn't workingneeds more infono recent activity
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When using a control WrappedSwitch that extends another control WrappedCheckbox which then extends InputBase<bool> using the WrappedSwitch with @bind-Value="SomeBool" will compile ok in 7.0.203 but in 7.0.302 results in:
error RZ9991: The attribute names could not be inferred from bind attribute 'bind-Value'. Bind attributes should be of the form 'bind' or 'bind-value' along with their corresponding optional parameters like 'bind-value:event', 'bind:format' etc.
Expected Behavior
The code should compile in both sdk vesions
Steps To Reproduce
Create a new blazor wasm project from a template.
In the shared folder create the following controls:
WrappedCheckbox
@using System.Diagnostics.CodeAnalysis
@inherits InputBase<bool>
<div class="form-check @WrapperDivCSS">
<input id="@Id" class="form-check-input" type="checkbox" @bind="CurrentValue" @attributes="AdditionalAttributes" />
<label class="form-check-label" for="@Id">@Label</label>
</div>
@code {
[Parameter] public string? Label { get; set; }
[Parameter] public string? WrapperDivCSS { get; set; }
string Id { get; init; } = Guid.NewGuid().ToString();
protected override bool TryParseValueFromString(string? value, out bool result, [NotNullWhen(false)] out string? validationErrorMessage)
{
bool parsed = bool.TryParse(value, out result);
validationErrorMessage = parsed ? null : $"Failed to parse {value} as a boolean";
return parsed;
}
}WrappedSwitch
@inherits WrappedCheckbox
<WrappedCheckbox Label="@Label" Value="@Value" ValueChanged="@ValueChanged" ValueExpression="@ValueExpression"
DisplayName="@DisplayName" WrapperDivCSS="form-switch" AdditionalAttributes="@AdditionalAttributes" />
@code {
}Then replace the Index page with:
@page "/"
<PageTitle>Index</PageTitle>
<EditForm Model="EditItem">
<WrappedSwitch Label="My Switch" @bind-Value="EditItem.MyProp"/>
</EditForm>
@code {
public class EditModel
{
public bool MyProp { get; set; }
}
public EditModel EditItem { get; set; } = new();
}Compile using both sdks and 203 will succeed while 302 fails
Exceptions (if any)
No response
.NET Version
No response
Anything else?
No response
Lorcan-exida, adospace, fretje, MichelJansson, oiBio and 1 more
Metadata
Metadata
Assignees
Labels
area-compilerUmbrella for all compiler issuesUmbrella for all compiler issuesbugSomething isn't workingSomething isn't workingneeds more infono recent activity