Skip to content

[Bug] Confusing version comparison: version2 = version1.EndsWith("+") #442

Closed
@qbit86

Description

@qbit86

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2018.4.10f1
  • External Dependency Manager version: 1.2.165
  • Source you installed EDM4U: .unitypackage
  • Features in External Dependency Manager in use: Android Resolver, VersionHandler
  • Plugins SDK in use: Firebase, Facebook, etc.
  • Platform you are using the Unity editor on: Mac, Windows

[REQUIRED] Please describe the issue here:

I was reading sources of Dependency class investigating another issue. And was confused by this argument coercion in IsGreater() method [1]:

version2 = version1.EndsWith("+") ?
    version2.Substring(0, version2.Length - 1) : version2;

Shouldn't it be version2?

version2 = version2.EndsWith("+") ? ...

Or with TrimEnd() [2]:

version2 = version2?.TrimEnd(...);

Please answer the following, if applicable:

What's the issue repro rate?

100%

How can we make the problem occur?

Take a look at Dependency.IsGreater(string version1, string version2)

[1] source/JarResolverLib/src/Google.JarResolver/Dependency.cs#L196
[2] https://docs.microsoft.com/en-us/dotnet/api/system.string.trimend?view=net-5.0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions