public string GetLatestVersion()

in JetBrains.Profiler.SelfApi/src/Impl/NuGet.cs [407:429]


        public string GetLatestVersion(SemanticVersion packageVersion)
        {
          string latestOriginal = null; // the latest found version including build meta-info
          SemanticVersion latest = null; // the latest parsed version w/o meta-info 
          foreach (var sVer in Versions)
          {
            var ver = SemanticVersion.TryParse(sVer);
            if (ver == null || ver.Version2 != packageVersion.Version2)
              continue;

            if (latest == null || latest.CompareTo(ver) <= 0)
            {
              latestOriginal = sVer;
              latest = ver;
            }
          }

          if (latestOriginal == null)
            throw new InvalidOperationException(
              $"Something went wrong: unable to find the latest package of v{packageVersion}");

          return latestOriginal;
        }