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
"Specified cast is not valid" on jre8 upgrade #18
Comments
Hmmm. That's very odd, especially as I test this on win7 and win10 systems.... Is there anything special about the ones this is failing on?
…Sent from my iPhone
On Jul. 31, 2018, at 8:09 AM, yaumsnus ***@***.***> wrote:
Hello,
On some w10 hosts, Specified cast is not valid error message is encoutered when trying to upgrade jre8.
It seems that the Get-ItemProperty command is badly interpreted on these hosts when building $checkreg64 and $checkreg32.
In the Get-ItemProperty documentation, the registry path is prefixed by the 'Registry::' string.
https://docs.microsoft.com/fr-fr/powershell/scripting/getting-started/cookbooks/working-with-registry-entries?view=powershell-5.1
Modified and cpacked this in a new jre8 package solved my problem on many systems. Can you fix it upstream?
Regards,
Guillaume
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
Thanks for the additional info. My best guess at this point is that there is an issue in the registry on affected computers, but I haven't been able to replicate it on my end. Any chance you could try running those commands manually and see if it specifies the key its having issues with? |
@proudcanadianeh I get an error when running the commands given in the answer:
|
Remove the checkreg64 variable from the front. Then, try this: |
The commands are accepted, but I still can't install and receive the same
|
The answer on Superuser.com was updated with more information. From the comments, you get "Specified cast is not valid" when querying Run the below:
For example, if the results of the above look like this:
Then the last key you were able to successfully query was fake_key_name_3. The key we could not query was the next key in the list. Open regedit and browse to the next key name (presumably, fake_key_name_4). This is where the failure is. There should be an invalid subkey here. Fix this, then run the command again. If you get no errors, you're all set. If you get more keys with errors, find and fix their invalid subkeys. In the case of one of the linked examples I originally provided, the user would expect to find a REG_DWORD key with data = "(invalid DWORD (32-bit) value)". This is the key to fix. |
Just wondering, were you able to follow that suggestion and find the invalid key? What did it turn out to be? |
I am facing the same issue.
Even with that new version (download link), I receive "ERROR: Specified cast is not valid." upon installation. I could track down the offending registry key (by the SuperUser question linked above): Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\nbi-nb-base-8.2.0.0.201609300101\ | % { Write-Host "Key Name:" $_.PSChildName } It's NetBeans! I've just found out the SuperUser question already mentioned three occurrences of the same error with NetBeans:
I've now uninstalled NetBeans, I didn't use it anyway. |
I'm glad the Superuser answer helped. I should probably write a more elegant way to check for the invalid key. The real problem is that this isn't an issue specific to this package, it's a general registry issue, so there's no single place to report the solution. |
There might be a single solution, though. Somewhere I read that there's a Chocolatey helper as a wrapper around querying the registry without causing this PowerShell bug. I am a (co-)maintainer of the Netbeans Choco package, so if someone has a fix for the registry issue I could add to the chocolateyInstall.ps1, I'd be happy to do so. |
Sorry for the late reply. I also have NetBeans installed and didn't have issues with the package before NetBeans. |
Hmmm, I am curious about this choco wrapper that can prevent the error... Is there any chance someone could export and upload a .reg file with the invalid entry in it? I want to do some troubleshooting but need to be able to replicate the issue first. |
Its about time I do something with this issue. After doing a bunch of research, this is a netbeans issue. There is an open request on their bug tracker about this and I dont think its really my place to try and do anything about this. Sorry I dont have better news :( |
Workaround (in a future blog post at https://wiert.me) based on this StackOverflow answer :
Note that the script lists the Registry keys in insertion order, whereas RegEdit shows them in alphabetical order. Those orders usually differ a lot. My PowerShell knowledge is not sufficient yet to:
|
Hello,
On some w10 hosts, Specified cast is not valid error message is encoutered when trying to upgrade jre8.
It seems that the Get-ItemProperty command is badly interpreted on these hosts when building $checkreg64 and $checkreg32.
In the Get-ItemProperty documentation, the registry path is prefixed by the 'Registry::' string.
https://docs.microsoft.com/fr-fr/powershell/scripting/getting-started/cookbooks/working-with-registry-entries?view=powershell-5.1
Modified and cpacked this in a new jre8 package solved my problem on many systems. Can you fix it upstream?
Regards,
Guillaume
The text was updated successfully, but these errors were encountered: