@@ -494,6 +494,41 @@ public async Task UndefinedDelegate_CanReturnCustomValue()
494494 Assert . Equal ( "[missing not found] [another not found]" , result ) ;
495495 }
496496
497+ [ Fact ]
498+ public async Task StrictVariables_ExceptionMessage_ContainsPropertyName ( )
499+ {
500+ // This test verifies that the exception message contains the actual property name
501+ // rather than the type name like "Fluid.Ast.IdentifierSegment"
502+ _parser . TryParse ( "{{ event.userId }}" , out var template , out var _ ) ;
503+ var options = new TemplateOptions { StrictVariables = true } ;
504+ var context = new TemplateContext ( options ) ;
505+
506+ // Set event but without userId property
507+ context . SetValue ( "event" , new { email = "test@example.com" } ) ;
508+
509+ var exception = await Assert . ThrowsAsync < FluidException > ( ( ) => template . RenderAsync ( context ) . AsTask ( ) ) ;
510+
511+ // The exception message should contain "userId"
512+ Assert . Contains ( "userId" , exception . Message ) ;
513+ }
514+
515+ [ Fact ]
516+ public async Task StrictVariables_ExceptionMessage_WithNestedProperty ( )
517+ {
518+ // Test that nested property access also shows the correct property name
519+ _parser . TryParse ( "{{ user.profile.avatar }}" , out var template , out var _ ) ;
520+ var options = new TemplateOptions { StrictVariables = true } ;
521+ var context = new TemplateContext ( options ) ;
522+
523+ // Set user with profile but without avatar property
524+ context . SetValue ( "user" , new { profile = new { name = "John" } } ) ;
525+
526+ var exception = await Assert . ThrowsAsync < FluidException > ( ( ) => template . RenderAsync ( context ) . AsTask ( ) ) ;
527+
528+ // The exception message should contain "avatar"
529+ Assert . Contains ( "avatar" , exception . Message ) ;
530+ }
531+
497532 private ( TemplateOptions , List < string > ) CreateStrictOptions ( )
498533 {
499534 var missingVariables = new List < string > ( ) ;
0 commit comments