Skip to content

TelemetryConfigurationFactory should be able to read numbers in hexadecimal format #551

@karolz-ms

Description

@karolz-ms

Currently it is not possible for numeric properties in the configuration to use hexadecimal numbers. For example

<Add ProviderName="Microsoft-Windows-PowerShell" Keywords="128" />

works but

<Add ProviderName="Microsoft-Windows-PowerShell" Keywords="0x80" />

does not.

Using hexadecimal values is very convenient when the property represents some flags. We should support it.

The reason this does not work today is that TelemetryConfigurationFactory.LoadInstanceFromValue() method calls into Convert.ChangeType(), which does not support hexadecimal values. For numeric properties we should try harder. For example, if the value starts with 0x or 0X, we could attempt Int32.TryParse() with AllowHexPrefix set before falling back to Convert.ChangeType.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions