Bug 47596 - Version.Parse exception from maccore
Summary: Version.Parse exception from maccore
Status: RESOLVED ANSWERED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Other ()
Version: Master
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-11-21 19:58 UTC by Jon Purdy
Modified: 2017-01-03 14:20 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Jon Purdy 2016-11-21 19:58:07 UTC
In my SDK path[1], there are two files: MacOS.sdk, and MacOS10.12.sdk. The latter is a symlink to the former. The version parsing in this commit[2] fails on these files because MacOS.sdk has no version number, so Version.Parse is called on an empty string, raising an exception. I’m on OS X 10.11.6 with Xcode 8.1.

[1]: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
[2]: https://github.com/xamarin/maccore/commit/20f9f24fd06926b8d0a901b1cd392bcb297ffa63#diff-cc4e0138ecbccb94744a52bc89364ff9R321
Comment 1 Vincent Dondain [MSFT] 2016-11-22 13:23:50 UTC
Hi Jon,

Please include your full build logs, crash reports (if any), test case (to reproduce) and all version informations.
Comment 2 Jon Purdy 2016-11-22 20:39:57 UTC
Small typo: it was actually MacOSX.sdk and MacOSX10.12.sdk. I saw this when building the installer @ master (313225d40cf50e51478ba2b69962c0772a9051d8):

> xbuild XamarinInstaller.Mac.sln
...
System.ArgumentException: Version string portion was too short or too long.
  at System.Version+VersionResult.SetFailure (ParseFailureKind failure, System.String argument) <0x1115a2e80 + 0x00085> in <filename unknown>:0
  at System.Version+VersionResult.SetFailure (ParseFailureKind failure) <0x1115a2e40 + 0x0002f> in <filename unknown>:0
  at System.Version.TryParseVersion (System.String version, System.VersionResult& result) <0x10e521200 + 0x000a5> in <filename unknown>:0
  at System.Version.Parse (System.String input) <0x10e7d5970 + 0x000ad> in <filename unknown>:0
  at Xamarin.Bundler.Driver.SetSDKVersion () <0x1115a27a0 + 0x0028b> in <filename unknown>:0
  at Xamarin.Bundler.Driver.Compile (IEnumerable`1 internalSymbols) <0x11159fd80 + 0x001f9> in <filename unknown>:0
  at Xamarin.Bundler.Driver.Pack (IList`1 unprocessed) <0x10e7c3970 + 0x010a8> in <filename unknown>:0
  at Xamarin.Bundler.Driver.Main2 (System.String[] args) <0x10e700000 + 0x03219> in <filename unknown>:0
  at Xamarin.Bundler.Driver.Main (System.String[] args) <0x10e51b8a0 + 0x00069> in <filename unknown>:0
  at System.Version+VersionResult.SetFailure (ParseFailureKind failure, System.String argument) <0x1115a2e80 + 0x00085> in <filename unknown>:0
  at System.Version+VersionResult.SetFailure (ParseFailureKind failure) <0x1115a2e40 + 0x0002f> in <filename unknown>:0
  at System.Version.TryParseVersion (System.String version, System.VersionResult& result) <0x10e521200 + 0x000a5> in <filename unknown>:0
  at System.Version.Parse (System.String input) <0x10e7d5970 + 0x000ad> in <filename unknown>:0
  at Xamarin.Bundler.Driver.SetSDKVersion () <0x1115a27a0 + 0x0028b> in <filename unknown>:0
  at Xamarin.Bundler.Driver.Compile (IEnumerable`1 internalSymbols) <0x11159fd80 + 0x001f9> in <filename unknown>:0
  at Xamarin.Bundler.Driver.Pack (IList`1 unprocessed) <0x10e7c3970 + 0x010a8> in <filename unknown>:0
  at Xamarin.Bundler.Driver.Main2 (System.String[] args) <0x10e700000 + 0x03219> in <filename unknown>:0
  at Xamarin.Bundler.Driver.Main (System.String[] args) <0x10e51b8a0 + 0x00069> in <filename unknown>:0
Comment 3 Vincent Dondain [MSFT] 2017-01-03 14:20:04 UTC
Hi Jon,

The code you're pointing to in your first comment is very old. `mmp/driver.cs` is not in maccore anymore but in `xamarin-macios`.

I don't think your issue would happen with XI master. See: https://github.com/xamarin/xamarin-macios/blob/master/tools/mmp/driver.cs#L606

We do a `Version.TryParse` now rather than a `Version.Parse`.

I tried to build the installer with XI master and it works just fine.

> xbuild XamarinInstaller.Mac.sln

Therefore I'm closing this bug as there is no way for me to reproduce it and the solution is likely to use recent code (bump needed?).

If you're still experiencing the issue please reopen this bug.