Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
karolz-ms opened this issue May 4, 2017 · 4 comments

Comments

@karolz-ms
Copy link
Contributor

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.

@SergeyKanzhelev
Copy link
Contributor

Good idea. Would you send a PR?

@karolz-ms
Copy link
Contributor Author

Will do

@Dmitry-Matveev
Copy link
Member

@karolz-ms did you have time to take a look at this?

@karolz-ms
Copy link
Contributor Author

Sorry :-*/

Not in foreseeable future

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

No branches or pull requests

3 participants