Skip to content

Hexadecimal und binary literals sometimes are interpreted as decimal #955

Description

@Molinarius

With version 1.6.9 on .NET 9, sometimes hexadecimal and binary literals are interpreted as decimal, e.g. both 0x10 and 0b10 become ten.

Example:

using System.Linq.Dynamic.Core;
using System;
					
public class Program
{
	public static void Main()
	{
		Console.WriteLine(DynamicExpressionParser.ParseLambda(ParsingConfig.Default, [], typeof(long), "0x10").Compile().DynamicInvoke());
		Console.WriteLine(DynamicExpressionParser.ParseLambda(ParsingConfig.Default, [], typeof(long), "0xa").Compile().DynamicInvoke());
		Console.WriteLine(DynamicExpressionParser.ParseLambda(ParsingConfig.Default, [], typeof(long), "0b10").Compile().DynamicInvoke());
	}
}

Output:

10
10
10

Fiddle: https://dotnetfiddle.net/0uBzM9

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions