question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in LayoutComponent breaks at the wrong location.

See original GitHub issue

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. devenv_gW2iccCo1l Notice that this error is appearing at this.StateHasChanged() and not at “PrintMessage.razor”

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mkArtakMSFTcommented, Oct 1, 2019

Thanks for contacting us, @Bambofy. We’ll look into this post 3.1 timeframe and will get back to you then.

0reactions
captainsafiacommented, May 8, 2020

I just gave this a go on VS 16.6 Preview and the exception breaks at the LowercaseMessage = Message.ToLower(); line so it looks like this issue is resolved now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Page layout broken in React Router v6
I tried to follow the docs but now the layout component is placed above all the pages it should be wrapping, not just...
Read more >
[Next 13] Server Component + Layout.tsx - Can't access the ...
Verify canary release I verified that the issue exists in the latest Next.js canary release Provide environment information Operating ...
Read more >
Force Immediate Layout Update
Anytime you change a RectTransform (or any UI element that needs its quads redrawn) it ... type-of-layout-group-error/58056555#58056555>.
Read more >
Solving Common Layout Problems (The Java™ Tutorials > ...
This Swing Java Tutorial describes developing graphical user interfaces (GUIs) for applications and applets using Swing components.
Read more >
Resolve common errors for Dashboard Components
This error can happen even if you can see fewer than 20 components on your dashboard. Examples: When you change the Dashboard Layout...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found