-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
✔️ Resolution: FixedThe bug or enhancement requested in this issue has been checked-in!The bug or enhancement requested in this issue has been checked-in!area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.
Milestone
Description
If you have an error in the properties of a layout component, the error appears at the parent razor page include line instead of the actual error location.
Example:
Index.razor (this is where the error breaks at):
<MyProject.PrintMessage ParameterMessage="@Message"/>
PrintMessage.razor (where the real error is):
public static string LowercaseMessage = "";
// route the given parameters to static, this is because our JSInvokables are static.
public static string Message = "";
[Parameter]
public string ParameterMessage
{
get
{
return Message;
}
set
{
LowercaseMessage = Message.ToLower(); // <--------- this is the real error here since Message is undefined.
Message = value;
}
}
... razor code ..
[JSInvokable]
public static string OnMouseClickPrintMessage()
{
string message = LowercaseMessage;
// do something with message
}
`
This is the error when you try to load the <MyProject.PrintMessage ParameterMessage="@message"/> razor snippet.

Notice that this error is appearing at this.StateHasChanged() and not at "PrintMessage.razor"
Metadata
Metadata
Assignees
Labels
✔️ Resolution: FixedThe bug or enhancement requested in this issue has been checked-in!The bug or enhancement requested in this issue has been checked-in!area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.