title: Dynamic Projection using DynamicExpressionParser ParseLambda
body: <p>I'm trying to convert some code that creates a dynamic projection from .Net 4.5 to .Net Core 3; I have the following code in .Net 4.5</p>
  
  <pre><code>var e = DynamicExpression.ParseLambda(
                  typeof(MyModel),
                  typeof (object),
                  "new(Id as id)");
  </code></pre>
  
  <p>ParseLambda is not available on DynamicExpression in .Net Core 3, so I changed the code to:</p>
  
  <pre><code>var e = DynamicExpressionParser.ParseLambda(
              typeof(MyModel),
              typeof (object),
              "new(Id as id)");
  </code></pre>
  
  <p>But this results in a null reference exception with the following stack trace</p>
  
  <pre><code>   at System.Linq.Dynamic.Core.Parser.ExpressionParser.CreateNewExpression(List`1 properties, List`1 expressions, Type newType)
     at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseNew()
     at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseIdentifier()
     at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParsePrimary()
     at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseUnary()
     at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseMultiplicative()
     at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseAdditive()
     at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseShiftOperator()
     at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseComparisonOperator()
     at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseLogicalAndOrOperator()
     at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseIn()
     at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseAndOperator()
     at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseOrOperator()
     at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseLambdaOperator()
     at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseNullCoalescingOperator()
     at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseConditionalOperator()
     at System.Linq.Dynamic.Core.Parser.ExpressionParser.Parse(Type resultType, Boolean createParameterCtor)
     at System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda(ParsingConfig parsingConfig, Boolean createParameterCtor, ParameterExpression[] parameters, Type resultType, String expression, Object[] values)
     at System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda(Boolean createParameterCtor, Type itType, Type resultType, String expression, Object[] values)
     at System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda(Type itType, Type resultType, String expression, Object[] values)
  </code></pre>
  
  <p>The code works fine when the expression is "Id == 0" or any other comparison, but I cannot get the "new" expression to work...</p>