Illegal one-byte branch error

Mar 25, 2009 at 9:26 PM
Edited Mar 25, 2009 at 9:26 PM
I have the following expression that give me the:

System.NotSupportedException: Illegal one-byte branch at position: 118. Requested branch was: 143.
   at System.Reflection.Emit.ILGenerator.BakeByteArray()
   at System.Reflection.Emit.DynamicResolver..ctor(DynamicILGenerator ilGenerator)
   at System.Reflection.Emit.DynamicILGenerator.GetCallableMethod(Void* module)
   at System.Reflection.Emit.DynamicMethod.GetMethodDescriptor()
   at System.Reflection.Emit.DynamicMethod.CreateDelegate(Type delegateType)
   at Ciloci.Flee.Expression`1.Compile(String expression, Object owner, ExpressionOptions options)
   at Ciloci.Flee.Expression`1..ctor(String expression, ExpressionContext context)
   at Ciloci.Flee.ExpressionFactory.CreateGeneric[T](String expression, ExpressionContext context)
   at ExpressionEval.CreateGenericExpression[T](String expression, ExpressionContext context)
   at ExpressionEval.Evaluate(String expression)
   at StrategyHelper.DoExpression(Guid modelEntityId, ClaimMaster claim)

(((((402 >= 360 AND 402 <= 361))) OR (((402 >= 369 AND 402 <= 369))) OR (((402 >= 490 AND 402 <= 490))) OR (((402 >= 499 AND 402 <= 499)))) AND (((("76856" = "47562" OR "76830" = "47562") OR ("76856" = "47563" OR "76830" = "47563") OR ("76856" = "47564" OR "76830" = "47564"))))) OR (((402 >= 360 AND 402 <= 361) OR (402 >= 369 AND 402 <= 369) OR (402 >= 490 AND 402 <= 490) OR (402 >= 499 AND 402 <= 499)) AND (("76856" = "47562" OR "76830" = "47562") OR ("76856" = "47563" OR "76830" = "47563") OR ("76856" = "47564" OR "76830" = "47564")))

If I break the expression up like so and run each separately they work, but error out when run together:

(((((402>=360 AND 402<=361))) OR (((402>=369 AND 402<=369))) OR (((402>=490 AND 402<=490))) OR (((402>=499 AND 402<=499)))) AND (((("76856"="47562" OR "76830"="47562") OR ("76856"="47563" OR "76830"="47563") OR ("76856"="47564" OR "76830"="47564")))))

OR   

(((((402>=360 AND 402<=361))) OR (((402>=369 AND 402<=369))) OR (((402>=490 AND 402<=490))) OR (((402>=499 AND 402<=499)))) AND (((("76856"="47562" OR "76830"="47562") OR ("76856"="47563" OR "76830"="47563") OR ("76856"="47564" OR "76830"="47564"))))

I have the latest code, version 0.9.23.0 

Thanks,

Jason
Coordinator
Mar 27, 2009 at 3:30 AM
Yeah, I can reproduce it and it looks like a bug.  Can you log it in the issue tracker?


Apr 2, 2009 at 7:54 PM
Done.  Any idea on how hard it would be to fix? 
Coordinator
Apr 4, 2009 at 3:10 AM
Edited Apr 4, 2009 at 3:11 AM
>Done.  Any idea on how hard it would be to fix? 
I had to do a medium re-write on how I compute branch lengths since the original version didn't account for a case that this expression has.

The above expression now compiles and evaluates on 0.9.24.0