Skip to content

[Blazor] Generate better error message(s) when we encounter an unknown RenderTreeFrameTypeΒ #63229

@javiercn

Description

@javiercn

When we throw here:

default:
throw new NotImplementedException($"Encountered unsupported frame type during diffing: {newTree[newFrameIndex].FrameTypeField}");

We can use the DiffContext to (using the Renderer, get the ComponentState for the current component, get the Component and get the type for the component.

We should add a private static CreateDiffErrorMessage that we can call to:

  • Collect this information.
  • Produce a more detailed error message that includes:
    • The component type (maybe the set of component types walking through the component state Parent property up to the root component)
    • The newTree set of frame types up to the failing frame as well as the length.

An example would be something like this:

Encountered an unsupported frame type during diffing {newTree[newFrameIndex].FrameTypeField} for Component Path: 'RootType -> Child -> GrandChild -> ErrorComponent' on tree with length 'N' and contents 'FirstFrameType, SecondFrameType, ThirdFrameType'.

Metadata

Metadata

Assignees

Labels

area-blazorIncludes: Blazor, Razor Components

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions