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

PDIndexer is not working on computer with the decimal separator set as ',' instead of '.' #2

Open
loictoraille opened this issue Nov 28, 2024 · 6 comments

Comments

@loictoraille
Copy link

Hello and thank you for this marvelous software.

We've encountered an issue when trying to use PDIndexer on computers with the windows decimal separator set as ',' instead of '.'
The data (in .xy form for example) is not opening at all in these cases.

We've tried editing the data by replacing the '.' in the xy file by ',' and in that case the data opens, but not correctly (plotted spectra have no real sense and do no look like the original data).

When we change the decimal separator in the windows settings, everything works correctly. However this solution does not work for shared computer where other users have set up software with their regular ',' decimal separator, and thus prevent us from changing it.

We've tried looking at your software code, and it looks like you tried to account for this issue, but it still does not work.
It seems like using 'CultureInfo.InvariantCulture' in the parse function may be a way to solve this issue.

If you have the time, could you look into this problem?

Thanks in advance,

Best regards,

Loïc Toraille

@seto77
Copy link
Owner

seto77 commented Dec 2, 2024

Thank you for reporting the bug!
The decimal separator issue is hard for developers to notice, so this is very helpful.

Indeed, as you say, the property 'CultureInfo.InvariantCulture' would seem to solve the issue. Great advice, thanks!

In the latest version (v4.447), I tried incorporating this property.
In my environment, regardless of the Windows OS settings, and regardless of whether the decimal separator is '.' or ',' the software is now able to read x and y values correctly.

Please check it on Loïc-san's PC. I hope it works well.

@loictoraille
Copy link
Author

loictoraille commented Dec 2, 2024

Thank you for your fast reaction.
I do not have good news. I've tested different things on different computers to try to understand the problem, here's what I've gathered:

  1. After installing .NET version 9 on a computer, PDIndexer does not start at all anymore if the Windows OS decimal separator settings is a comma ',' independently of the version 4.446 or 4.447 of PDIndexer. The only way to start PDIndexer is to set the Windows OS settings to a dot '.'

  2. In version 4.446, everything works when using the windows dot settings. In version 4.447, PDIndexer starts correctly but loading a profile does not work. When using drag and drop, nothing happens; when using file>read profile, an error stating something like "the input string '-----' was not in a correct form" appears, where ----- is the first line of the file.

  3. Third weird thing: once the .NET version 9 has been installed on a computer, it is no longer possible to launch the version 4.446 with the comma setting, even after uninstalling the .NET version 9. I guess the uninstallation does not fully remove everything.

  4. A bit more information on what happened previously with the 4.446: when loading a profile in PDIndexer, there is a popup window which asks for the wavelength value. This is an easy way to check the windows OS decimal separator, because when modifying the wavelength value, the energy value is updated only if the wavelength is input correctly. So this property expects a dot when windows is in dot, and a comma when windows is in comma. It is essential to restart PDIndexer after changing the windows setting for changes to take effect. So things seemed to work for this specific part, but not for the actual loading of the spectra.

  5. Lastly: to mess things up a bit more, the format of the spectra we usually use is written with dots (usually exported directly from Dioptas), not commas. The whole confusion may come from here? But changing 'manually' the characters in these spectra does not work either, so I'm not clear on this part.

My thinking is that you did something somewhere which looks at the computer, decides which decimal format it should expect data depending on the region, but then uses the actual decimal separator of the computer (which can be set independently of the expected region), and everything is messed up by the fact that with the new .NET framework, the software cannot launch at all with the comma setting.

I'm not sure what the best way to solve all these issues is, and I'm not sure why you do not have problems in your own environment. For now I have reverted to v4.446 on my own computer, but that does not solve the original issue.
Let me know if I can help you with any test.

Here is a link to download an example spectrum, its correct opening in v4.446, and a bad opening when changing manually the characters.

https://filesender.renater.fr/?s=download&token=b1981cf4-125f-42e1-a17f-9d21c6b7e78a

@seto77
Copy link
Owner

seto77 commented Dec 3, 2024

I apologize for any inconvenience caused. A further revised version (v4.448) has been released.

First, uninstall PDIndexer, and if the following folders exist, delete them all.
C:\Users\xxxx\AppData\Local\Crystallography Software\IPAnalyzer
C:\Users\xxxx\AppData\Roaming\PDIndexer
("xxx" is your username)

In addition, delete the following entry by a registry editor.
\HKEY_CURRENT_USER\Software\Crystallography\PDIndexer

After performing the above steps, please try installing ver4.448. I think this should work.

My PC environment is Windows 11 (24h2). I tried the test with the language setting set to French. As you can see from the screenshot below, it appears to be working correctly.
Capture d'écran 2024-12-03 112525
“period.dat” and ‘comma.dat’ are the data you sent. The former has the decimal point symbol set to ‘.’ and the latter to ‘,’. As you can see, both files are being read correctly.

There may be some Windows settings that I don't know about. If this version doesn't work either, please tell me a little more about loictoraille-san's PC environment.

@loictoraille
Copy link
Author

This time it works, thank you very much!
I've done some tests to understand better what was the problem.
I'm using windows 10 or windows 7 depending on the computer, no windows 11 here yet.
The key part was the registry. No need to remove what's left in the AppData directories.

I think a last small improvement might be useful.

When PDIndexer is opened and closed for the first time, it writes a bunch of keys in the registry, including the 'Version' key. This key value is set to either "4.448" or "4,448" depending on windows parameters at the moment when PDIndexer was opened.
If the key is stored with the dot and the windows settings are changed to comma afterward, then PDIndexer is no longer able to open. Basically, in the current state if the windows settings are modified after the first opening of PDIndexer, then PDIndexer is no longer able to open at all.
Deleting this single key is enough to reset, any windows parameter then allows PDIndexer to correctly open (and store the new key value).
This limitation seems a bit silly to me, changing the name of the version to 4448 would be enough to resolve this I guess.

Apart from that, the opening of file written with either dot or comma work, which is amazing, thanks a lot!

@seto77
Copy link
Owner

seto77 commented Dec 6, 2024

This limitation seems a bit silly to me, changing the name of the version to 4448 would be enough to resolve this I guess.

Oh, that's a great idea that makes me see things in a new light. I've implemented it right away. The problem you pointed out should be solved in ver. 4.449 and later.

@loictoraille
Copy link
Author

Amazing! Thank you again for your work and your reactivity :)

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

No branches or pull requests

2 participants