The property [property] has a type [type] that can't be handled by this property construction node

SyntaxEditor for WPF Forum

Posted 12 years ago by Jonah Flor
Version: 12.1.0560
Avatar

The following terminal production is throwing an exception (the error is related to the section in bold):

additiveExpression.Production = multiplicativeExpression["leftexp"] + ( ( @addition >Ast( value: OperatorType.Addition.ToString() ) | @subtraction >Ast( OperatorType.Subtraction.ToString() ) ).SetLabel( "op" ) + additiveExpression["rightexp"] ).OnErrorContinue().Optional()

>AstConditional<BinaryOperatorExpression>( AstFrom( "leftexp" ), AstFrom( "rightexp" ) )

.SetProperty( expr => expr.OperatorType, AstFrom( "op" ) )

.SetProperty( expr => expr.LeftExpression, AstFrom( "leftexp" ) )

.SetProperty( expr => expr.RightExpression, AstFrom( "rightexp" ) );

The exception being thrown is:

{"The property '[...]LeftExpression' has a type '[...]IExpression' that can't be handled by this property construction node.\r\nParameter name: expression"}

I recently changed the LeftExpression property from a concrete class to an interface.  When it was a concrete class, it worked fine.  I would like to use the following:

.SetProperty( expr => expr.LeftExpression, AstFrom<ExpressionImplementation>( "leftexp" ) )

where ExpressionImplementation implements the interface that the LeftExpression property represents.  But ExpressionImplementation does not derive from AstNodeBase, because I am trying to abstract away all Actipro classes from that level of the application.  I'm pretty sure that I need to refactor my code in order to get this to work, but I figured I would post my question in case someone else sees a possible solution that I am missing.

[Modified 12 years ago]

Comments (1)

Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Jonah,

I think it will work for you if you ensure that your IExpression interface implements our IAstNode interface.  That will still be a dependency on our type but at least in that scenario it's just an interface and easily duplicated on your own as needed.


Actipro Software Support

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.