unitysetup.powershell icon indicating copy to clipboard operation
unitysetup.powershell copied to clipboard

Get-UnityLicense fails because the versioning is malformed

Open StephenHodgson opened this issue 6 years ago • 4 comments

Unity's license file doesn't always have well formed version definitions.

My personal license says it's for 2017.2.0 which is invalid to the UnityLicense this module expects.

image

Cannot convert value "2017.2.0" to type "UnityVersion". Error: "Invalid unity version: 2017.2.0"
At C:\Users\shodgson\Documents\WindowsPowerShell\Modules\UnitySetup\4.0.97\UnitySetup.psm1:1016 char:24
+ ...  'Serial' = ConvertTo-SecureString $licenseSerial -AsPlainText -Force ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastConstructorException

StephenHodgson avatar Jan 10 '19 01:01 StephenHodgson

Digging in a bit deeper I noticed our regex expression when parsing the version out may need to be updated a bit.

https://regex101.com/r/7AGvpa/2

Adding an | can match either the short version for long version (Also, seems to be faster too?!)

Likely we'll also need to update the match count check

StephenHodgson avatar Jan 10 '19 01:01 StephenHodgson

This is still an issue and should be reopened. I just got an error saying Cannot convert value "2017.2.0" to type "UnityVersion". Error: "Invalid unity version: 2017.2.0" when running Get-UnityLicense.

chrisdjali-wrld3d avatar Feb 15 '22 13:02 chrisdjali-wrld3d

This is also still an issue for both my Pro and Personal licenses

deitry avatar Jun 24 '22 16:06 deitry

It seems 2017.2.0 is being applied when license is activated via Unity Hub. If license is activated via command line with specific Unity.exe, license has that version

deitry avatar Jun 27 '22 12:06 deitry

Why's this been closed again? I don't see any changes that look relevant since it was reopened, and the only comment here in the meantime is repro instructions and an explanation of why not everyone's been able to reproduce the problem when they've tried.

chrisdjali-wrld3d avatar Jan 05 '23 15:01 chrisdjali-wrld3d

Because it's never gonna be addressed, and I've moved onto other tools

StephenHodgson avatar Jan 05 '23 16:01 StephenHodgson

I reopened, as this project is still actively maintained even if Stephen is moving on. If someone want to make a PR to support short versions in the licensing I'm happy to review. =)

jwittner avatar Jan 05 '23 16:01 jwittner

Fix available in 5.5.156-develop.

jwittner avatar Jul 14 '23 16:07 jwittner