@@ -746,10 +746,50 @@ private static void AppendDiffEntriesForFramesWithSameSequence(
746
746
// We don't handle attributes here, they have their own diff logic.
747
747
// See AppendDiffEntriesForAttributeFrame
748
748
default :
749
- throw new NotImplementedException ( $ "Encountered unsupported frame type during diffing: { newTree [ newFrameIndex ] . FrameTypeField } " ) ;
749
+ throw new NotImplementedException ( CreateDiffErrorMessage ( ref diffContext , newFrameIndex ) ) ;
750
750
}
751
751
}
752
752
753
+ private static string CreateDiffErrorMessage ( ref DiffContext diffContext , int newFrameIndex )
754
+ {
755
+ var newTree = diffContext . NewTree ;
756
+ var unsupportedFrameType = newTree [ newFrameIndex ] . FrameTypeField ;
757
+
758
+ // Build component hierarchy path
759
+ var componentPath = BuildComponentPath ( diffContext . Renderer , diffContext . ComponentId ) ;
760
+
761
+ // Build frame types descriptor
762
+ var frameTypesDescriptor = BuildFrameTypeDescriptor ( newTree , newFrameIndex ) ;
763
+
764
+ return $ "Encountered an unsupported frame type during diffing { unsupportedFrameType } for Component Path: '{ componentPath } ' on tree with length '{ newTree . Length } ' and contents '{ frameTypesDescriptor } '.";
765
+ }
766
+
767
+ private static string BuildFrameTypeDescriptor ( RenderTreeFrame [ ] renderTree , int frameIndex )
768
+ {
769
+ var frameTypes = new List < string > ( ) ;
770
+ for ( var i = 0 ; i <= frameIndex && i < renderTree . Length ; i ++ )
771
+ {
772
+ frameTypes . Add ( renderTree [ i ] . FrameTypeField . ToString ( ) ) ;
773
+ }
774
+
775
+ return string . Join ( ", " , frameTypes ) ;
776
+ }
777
+
778
+ private static string BuildComponentPath ( Renderer renderer , int componentId )
779
+ {
780
+ var componentPath = new List < string > ( ) ;
781
+ var currentComponentState = renderer . GetRequiredComponentState ( componentId ) ;
782
+
783
+ while ( currentComponentState is not null )
784
+ {
785
+ var componentType = currentComponentState . Component . GetType ( ) ;
786
+ componentPath . Insert ( 0 , componentType . Name ) ;
787
+ currentComponentState = currentComponentState . ParentComponentState ;
788
+ }
789
+
790
+ return string . Join ( " -> " , componentPath ) ;
791
+ }
792
+
753
793
// This should only be called for attributes that have the same name. This is an
754
794
// invariant maintained by the callers.
755
795
private static void AppendDiffEntriesForAttributeFrame (
0 commit comments