Bug 25211 - System.Exception: Unknown product version: 8.1.1
Summary: System.Exception: Unknown product version: 8.1.1
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: XI 8.4.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: 8.6.0
Assignee: Sebastien Pouliot
URL:
Depends on:
Blocks:
 
Reported: 2014-12-09 20:02 UTC by Jeffery Grajkowski
Modified: 2014-12-12 10:21 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:
VERIFIED FIXED

Description Jeffery Grajkowski 2014-12-09 20:02:20 UTC
The line of code:
    ObjCRuntime.PlatformHelper.GetHostApiPlatform()

causes the following exception:
    System.Exception: Unknown product version: 8.1.1
      at ObjCRuntime.PlatformHelper.ParseApiPlatform (System.String productName, System.String productVersion) [0x000b9] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/PlatformAvailability.cs:273
      at ObjCRuntime.PlatformHelper.GetHostApiPlatform () [0x0002c] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/PlatformAvailability.cs:246

when run on an iPad with iOS 8.1.1.  This happens in a new project, whether targeting the classic MonoTouch API or the new Unified API.

The development environment is:
    Mac OS X 10.9.5
    Xamarin Studio 5.5.4
    XCode 6.1
    Xamarin.iOS 8.4.0.43 (Business Edition)
Comment 1 Sebastien Pouliot 2014-12-09 20:42:33 UTC
Thanks! I recall some parsing issue that were fixed after 8.4 (mostly culture string parsing). With the upcoming XI 8.6 this code:

> var v = ObjCRuntime.PlatformHelper.ParseApiPlatform ("ios", "8.1.1");

will returns `Platform.iOS_8_1`. 

However I just realized the API does a validation check based on the enum so it's not future proof (it will throw if called next year from iOS 9, unless you have updated/rebuild with a new XI). 

I suggest you not to use this API directly. It's original purpose was internal testing but part of it were exposed, it seems, without removing that (validity) check. I'm keeping this bug open until that case is solved.


The best way to check for a version is to use:

> if (UIDevice.CurrentDevice.CheckSystemVersion (x,y)) { ... }

or other UIDevice properties.
Comment 2 Sebastien Pouliot 2014-12-09 21:18:10 UTC
Fixed in master 1066c35a8b77bd6a7d448532ad2413f8e2e6505d
Pending backport
Comment 3 Jeffery Grajkowski 2014-12-10 11:26:15 UTC
Thanks Sebastien.

I'm not actually trying to call that function myself.  It's an easy part to reproduce out of this full stack trace which is my actual problem.

    System.Exception: Unknown product version: 8.1.1
      at ObjCRuntime.PlatformHelper.ParseApiPlatform (System.String productName, System.String productVersion) [0x000b9] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/PlatformAvailability.cs:273
      at ObjCRuntime.PlatformHelper.GetHostApiPlatform () [0x0002c] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/PlatformAvailability.cs:246
      at Registrar.DynamicRegistrar.OnRegisterType (Registrar.ObjCType type) [0x0006f] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/DynamicRegistrar.cs:546
      at Registrar.Registrar.RegisterTypeUnsafe (System.Type type, System.Collections.Generic.List`1& exceptions) [0x00af2] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/Registrar.cs:1284
      at Registrar.Registrar.RegisterTypeUnsafe (System.Type type, System.Collections.Generic.List`1& exceptions) [0x00052] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/Registrar.cs:994
      at Registrar.Registrar.RegisterType (System.Type type) [0x0002e] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/Registrar.cs:896
      at Registrar.DynamicRegistrar.Lookup (IntPtr class, Boolean throw_on_error) [0x00041] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/DynamicRegistrar.cs:703
      at ObjCRuntime.Class.Lookup (IntPtr klass, Boolean throw_on_error) [0x00000] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/Class.cs:101
      at ObjCRuntime.Class.Lookup (IntPtr klass) [0x00000] in <filename unknown>:0
      at ObjCRuntime.Runtime.ConstructNSObject (IntPtr ptr, IntPtr klass, MissingCtorResolution missingCtorResolution) [0x00000] in <filename unknown>:0
      at ObjCRuntime.Runtime.GetNSObject (IntPtr ptr, MissingCtorResolution missingCtorResolution, Boolean evenInFinalizerQueue) [0x00022] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/Runtime.iOS.cs:490
      at ObjCRuntime.Runtime.GetNSObject (IntPtr ptr) [0x00000] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/Runtime.iOS.cs:478
      at Cordova.CDVPlugin.get_WeakCommandDelegate () [0x00044] in /Users/latitude/Projects/gmaf/_Libraries/bindings/Cordova-iOS/obj/Debug/ios/Cordova/CDVPlugin.g.cs:230
      at Cordova.CDVPlugin.get_CommandDelegate () [0x00002] in /Users/latitude/Projects/gmaf/_Libraries/bindings/Cordova-iOS/obj/Debug/ios/Cordova/CDVPlugin.g.cs:169
      at GeocortexApp.GeocortexAppPlugin.RegisterEventListener (Cordova.CDVInvokedUrlCommand command) [0x0007c] in /Users/latitude/Projects/gmaf/GeocortexApp.iOS/GeocortexAppPlugin.cs:63
      at at (wrapper managed-to-native) ApiDefinition.Messaging:bool_objc_msgSendSuper_IntPtr_IntPtr_int (intptr,intptr,intptr,intptr,int)
      at Cordova.CDVViewController.ShouldStartLoad (UIKit.UIWebView webView, Foundation.NSUrlRequest request, UIWebViewNavigationType navigationType) [0x000e1] in /Users/latitude/Projects/gmaf/_Libraries/bindings/Cordova-iOS/obj/Debug/ios/Cordova/CDVViewController.g.cs:372
      at GeocortexApp.View.WebViewController.ShouldStartLoad (UIKit.UIWebView webView, Foundation.NSUrlRequest request, UIWebViewNavigationType navigationType) [0x00055] in /Users/latitude/Projects/gmaf/GeocortexApp.iOS/View/WebViewController.cs:91
      at at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
      at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62
      at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0001c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:45
      at GeocortexApp.Application.Main (System.String[] args) [0x00017] in /Users/latitude/Projects/gmaf/GeocortexApp.iOS/Main.cs:25

(Yup, Cordova and Xamarin.  Don't ask.)
Comment 4 Sebastien Pouliot 2014-12-10 11:35:43 UTC
Ah, I see. That was changed too in the upcoming 8.6, i.e. the registrar won't be using PlatformHelper, but the code I suggested you (since it has a cheaper execution cost).

Thanks for the extra details - it makes things clearer :-)
Comment 5 Jeffery Grajkowski 2014-12-10 12:34:29 UTC
Is there a workaround to this bug until Xamarin.iOS 8.6 is released?  I'm a little nervous about using Alpha and it sounds like the Stable release is weeks away.
Comment 6 Sebastien Pouliot 2014-12-10 15:26:33 UTC
Backported to monotouch-8.6.0-branch 13fc57bd21257582c064895d56cb2746db300ecf

@Jeffery You should only hit this case if you're using the dynamic registrar on device. By default the static registrar is used (on devices) and won't have the issue. However you might have a specific reason for using the dynamic registrar, not not then your workaround is simple (for 8.4).

The alpha was released today[1] with a stable target for early January. From your stacktraces it seems you're using the unified API so I strongly suggest you to update to 8.6 as it contains the final API we'll be supporting in the future (i.e. unified was a preview in 8.4 and earlier XI releases).

[1] without this specific backport - but the next alpha/beta will have this fix

p.s. please do not change/update the bug status when commenting :)


QA: unit tests added (and backported)
Comment 7 Jeffery Grajkowski 2014-12-10 15:43:44 UTC
Thanks for the advice.  Sorry if the status changed when I commented, I didn't notice.
Comment 8 Ram Chandra 2014-12-12 10:21:52 UTC
I have checked this issue and I am able to reproduce this issue with X.iOS:

Screencast: http://www.screencast.com/t/SUNUEP5NG3

To verify this issue I have checked this issue with following builds:

Mac OS X 10.9.5
Xamarin Studio: 5.5.4 (build 15)
Mono 3.10.0 ((detached/92c4884)
GTK+ 2.24.23 (Raleigh theme)
Package version: 310000031
Xcode 6.1 (6604)
Build 6A1052d
Xamarin.iOS: 8.4.0.47 (Enterprise Edition)
=== Build Information ===
Release ID: 505040015
Git revision: f93940a35458a18052f1a25e106e62ca970d9c40
Build date: 2014-11-19 15:32:41-05
Xamarin addins: dc23cbd91a3a0e1d326328e1229e86c942a49ec8

I have created a "Single View Application" of "Unified API" and write the following code in "ViewDidLoad()" method and deployed application on iPad 8.1.1 

> ObjCRuntime.PlatformHelper.GetHostApiPlatform();

I observed that I am not getting any error/exception and application is deployed successfully.

I have also checked the same with "--registrar:dynamic" option and observed that application is working fine with dynamic register also.

Screencast: http://screencast.com/t/LYyiabTL

This issue has been fixed. Hence I am closing this issue.