Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlatformNotSupportedException on 32bits devices (e.g. iPad 2 and iOS 9.3) #7083

Closed
xperseguers opened this issue Sep 24, 2019 · 21 comments
Closed
Labels
bug If an issue is a bug or a pull request a bug fix iOS Issues affecting Xamarin.iOS
Milestone

Comments

@xperseguers
Copy link

Steps to Reproduce

  1. Download the official sample application xaminals from https://docs.microsoft.com/en-gb/samples/xamarin/xamarin-forms-samples/userinterface-xaminals/
  2. Upgrade Xamarin.Forms package to latest (4.2.0.815419)
  3. Run a simulation on iPhone 6s and iOS 9.3 => works
  4. Run a simulation on iPad 2 and iOS 9.3 => crashes

Expected Behavior

The application should not crash.

Actual Behavior

The application is crashing. Could not get a stacktrace with this project but with a real project of mine, and although I have other 3rd-party libraries initialization lines crashing earlier, it seems to crash as well with:

"  at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00018] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.0.0.19/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:890 \n  at System.Reflection.RuntimeConstructorInfo.DoInvoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0007a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.0.0.19/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:872 \n  at System.Reflection.RuntimeConstructorInfo.Invoke (System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.0.0.19/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:906 \n  at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.0.0.19/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Reflection/ConstructorInfo.cs:22 \n  at ObjCRuntime.Runtime.ConstructNSObject[T] (System.IntPtr ptr, System.Type type, ObjCRuntime.Runtime+MissingCtorResolution missingCtorResolution) [0x0003b] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.0.0.19/src/Xamarin.iOS/ObjCRuntime/Runtime.cs:1133 \n  at ObjCRuntime.Runtime.GetNSObject[T] (System.IntPtr ptr) [0x000d1] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.0.0.19/src/Xamarin.iOS/ObjCRuntime/Runtime.cs:1274 \n  at UIKit.UIKeyCommand.Create (Foundation.NSString keyCommandInput, UIKit.UIKeyModifierFlags modifierFlags, ObjCRuntime.Selector action) [0x0003b] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.0.0.19/src/Xamarin.iOS/UIKeyCommand.g.cs:107 \n  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement]..ctor () [0x00043] in <4e367b2cd46d4a02b980ea2aa2a1115b>:0 \n  at Xamarin.Forms.Platform.iOS.Platform+DefaultRenderer..ctor () [0x00000] in <4e367b2cd46d4a02b980ea2aa2a1115b>:0 \n  at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0000f] in <4e367b2cd46d4a02b980ea2aa2a1115b>:0 \n  at Xamarin.Forms.Platform.iOS.UIContainerView..ctor (Xamarin.Forms.View view) [0x0000d] in <4e367b2cd46d4a02b980ea2aa2a1115b>:0 \n  at Xamarin.Forms.Platform.iOS.ShellFlyoutContentRenderer..ctor (Xamarin.Forms.Platform.iOS.IShellContext context) [0x0001f] in <4e367b2cd46d4a02b980ea2aa2a1115b>:0 \n  at Xamarin.Forms.Platform.iOS.ShellRenderer.CreateShellFlyoutContentRenderer () [0x00000] in <4e367b2cd46d4a02b980ea2aa2a1115b>:0 \n  at Xamarin.Forms.Platform.iOS.ShellRenderer.Xamarin.Forms.Platform.iOS.IShellContext.CreateShellFlyoutContentRenderer () [0x00000] in <4e367b2cd46d4a02b980ea2aa2a1115b>:0 \n  at Xamarin.Forms.Platform.iOS.TabletShellFlyoutRenderer.Xamarin.Forms.Platform.iOS.IShellFlyoutRenderer.AttachFlyout (Xamarin.Forms.Platform.iOS.IShellContext context, UIKit.UIViewController content) [0x0000e] in <4e367b2cd46d4a02b980ea2aa2a1115b>:0 \n  at Xamarin.Forms.Platform.iOS.ShellRenderer.get_FlyoutRenderer () [0x0001a] in <4e367b2cd46d4a02b980ea2aa2a1115b>:0 \n  at Xamarin.Forms.Platform.iOS.ShellRenderer.get_NativeView () [0x00000] in <4e367b2cd46d4a02b980ea2aa2a1115b>:0 \n  at Xamarin.Forms.Platform.iOS.Platform.AddChild (Xamarin.Forms.VisualElement view) [0x00035] in <4e367b2cd46d4a02b980ea2aa2a1115b>:0 \n  at Xamarin.Forms.Platform.iOS.Platform.WillAppear () [0x00043] in <4e367b2cd46d4a02b980ea2aa2a1115b>:0 \n  at Xamarin.Forms.Platform.iOS.PlatformRenderer.ViewWillAppear (System.Boolean animated) [0x00016] in <4e367b2cd46d4a02b980ea2aa2a1115b>:0 \n  at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend_IntPtr(intptr,intptr,intptr)\n  at UIKit.UIWindow.set_RootViewController (UIKit.UIViewController value) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.0.0.19/src/Xamarin.iOS/UIWindow.g.cs:394 \n  at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.UpdateMainPage () [0x00043] in <4e367b2cd46d4a02b980ea2aa2a1115b>:0 \n  at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.ApplicationOnPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs args) [0x00012] in 

with inner exception:

{System.PlatformNotSupportedException: This API is not supported on this version of iOS
  at UIKit.UIMenuElement..ctor (System.IntPtr handle) [0x00007] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.0.0.19/src/Xamarin.iOS/UIMenuElement.g.cs:91 
  at UIKit.UICommand..ctor (System.IntPtr handle) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.0.0.19/src/Xamarin.iOS/UICommand.g.cs:88 
  at UIKit.UIKeyCommand..ctor (System.IntPtr handle) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.0.0.19/src/Xamarin.iOS/UIKeyCommand.g.cs:91 
  at (wrapper managed-to-native) System.Reflection.RuntimeConstructorInfo.InternalInvoke(System.Reflection.RuntimeConstructorInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.0.0.19/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:882 }

Environment

=== Visual Studio Community 2019 for Mac ===

Version 8.2.6 (build 73)
Installation UUID: b4ac9ff0-5e7a-4abe-9869-e145d0ee4e62
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 5.14.0.85 (d16-2-fix-mac-updates / 86973979)

	Package version: 600000334

=== Mono Framework MDK ===

Runtime:
	Mono 6.0.0.334 (2019-02/6256b82d62f) (64-bit)
	Package version: 600000334

=== NuGet ===

Version: 5.1.0.6013

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	2.1.12
	2.1.2
	2.1.1
	2.0.5
	2.0.0
SDK: /usr/local/share/dotnet/sdk/2.1.701/Sdks
SDK Versions:
	2.1.701
	2.1.302
	2.1.301
	2.1.4
	2.0.0
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.0.0/lib/mono/msbuild/Current/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.6.10
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 11.0 (14936)
Build 11A420a

=== Xamarin.Mac ===

Version: 6.0.0.19 (Visual Studio Community)
Hash: b02da292
Branch: xcode11
Build date: 2019-09-12 14:26:59-0400

=== Xamarin.iOS ===

Version: 13.0.0.19 (Visual Studio Community)
Hash: b02da292
Branch: xcode11
Build date: 2019-09-12 14:26:59-0400

=== Xamarin.Android ===

Version: 9.4.1.0 (Visual Studio Community)
Commit: xamarin-android/d16-2/ebd65c9
Android SDK: /Users/xavier/Library/Android/sdk
	Supported Android versions:
		5.0 (API level 21)
		5.1 (API level 22)
		6.0 (API level 23)
		7.0 (API level 24)
		7.1 (API level 25)
		8.0 (API level 26)
		8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.4
SDK Build Tools Version: 25.0.3

Build Information: 
Mono: mono/mono/2019-02@e6f5369c2d2
Java.Interop: xamarin/java.interop/d16-2@d64ada5
LibZipSharp: grendello/LibZipSharp/d16-2@caa0c74
LibZip: nih-at/libzip/rel-1-5-1@b95cf3f
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.27.1@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-2@6f6c969

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/xavier/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.9
1.8.0-9
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android Device Manager ===

Version: 1.2.0.60
Hash: 686c817
Branch: remotes/origin/d16-2
Build date: 2019-09-11 21:09:08 UTC

=== Xamarin Designer ===

Version: 16.2.0.432
Hash: 670cbe49c
Branch: remotes/origin/d16-2-xcode11
Build date: 2019-09-11 16:12:16 UTC

=== Xamarin Inspector ===

Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 802060073
Git revision: d556c56ffb6a6412b7d7681fd2385804fd4b5a12
Build date: 2019-09-13 15:07:24+00
Build branch: release-8.2-xcode11
Xamarin extensions: 81d0addb6bbf2533756cc882040741a21fb154ef

=== Operating System ===

Mac OS X 10.14.6
Darwin 18.7.0 Darwin Kernel Version 18.7.0
    Tue Aug 20 16:57:14 PDT 2019
    root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64

Example Project

https://docs.microsoft.com/en-gb/samples/xamarin/xamarin-forms-samples/userinterface-xaminals/

@xperseguers
Copy link
Author

Simulator does not crash on an iPad Air 2 with iOS 11. Sorry, no way to simulate iOS 10 anymore.

@spouliot
Copy link
Contributor

The inner exception tells you what's happening
System.PlatformNotSupportedException: This API is not supported on this version of iOS

The UIMenuElement is new in iOS 13. It might work in earlier OS but it was not a public API before 13.0 (which means Apple could reject the application). However using the simulator to test API availability is not a good idea (devices can behave differently).

You're running into another issue which is that the iPad 2 is a 32bits (only) device. So bindings for 64bits only API are not present (hence the easier to diagnose PlatformNotSupportedException instead of a native crash).

If you want to support older devices / iOS versions then you must ensure you either:

  • only call API that are available in the oldest;
  • have OS version checks around newer API so they are not called

@spouliot spouliot added iOS Issues affecting Xamarin.iOS support The issue is related to support labels Sep 24, 2019
@spouliot spouliot added this to the Future milestone Sep 24, 2019
@spouliot
Copy link
Contributor

spouliot commented Sep 24, 2019

Sorry, while the above is true, you instantiated a UIKeyCommand so the new (iOS13) types are only new base types (inside an existing hierarchy) and that should work. That's a bug (something we need to allow) in 32bits bindings.

@spouliot spouliot reopened this Sep 24, 2019
@spouliot spouliot added bug If an issue is a bug or a pull request a bug fix and removed support The issue is related to support labels Sep 24, 2019
@spouliot spouliot modified the milestones: Future, xcode11 Sep 24, 2019
spouliot pushed a commit to spouliot/xamarin-macios that referenced this issue Sep 24, 2019
… .ctor

Types that are new in 64bits only OS are generated differently on 32bits
bindings. They mainly throw a `PlatformNotSupportedException` so it's
easier to diagnose (than a crash) what's happening at runtime.

This works well in all cases except one. When a new type, let's say
`UIMenuElement` is added **and** serves as a new base type for existing
types.

`UIKeyCommand` (iOS 7) -> `UICommand` (iOS 13)-> `UIMenuElement` (iOS 13)

This is _correct_ as new base types can be added (in ObjC and C#).
However the generated code for the constructors of `UICommand` and
`UIMenuElement` would be throwing a `PlatformNotSupportedException`
which breaks the `UIKeyCommand` on 32 bits devices.

We fixed this in a few places by tweaking the availability attribute
but that requires spotting the new base type while doing bindings and
that is error prone [1][2].

This PR simply does let the `protected` constructor, using when chaining,
be generated normally. It's simpler and will cover all the cases (without
requiring hacks in the availability of those types)

[1] xamarin#7083
[2] xamarin#7084
spouliot added a commit that referenced this issue Sep 24, 2019
… .ctor (#7085)


Types that are new in 64bits only OS are generated differently on 32bits
bindings. They mainly throw a `PlatformNotSupportedException` so it's
easier to diagnose (than a crash) what's happening at runtime.

This works well in all cases except one. When a new type, let's say
`UIMenuElement` is added **and** serves as a new base type for existing
types.

`UIKeyCommand` (iOS 7) -> `UICommand` (iOS 13)-> `UIMenuElement` (iOS 13)

This is _correct_ as new base types can be added (in ObjC and C#).
However the generated code for the constructors of `UICommand` and
`UIMenuElement` would be throwing a `PlatformNotSupportedException`
which breaks the `UIKeyCommand` on 32 bits devices.

We fixed this in a few places by tweaking the availability attribute
but that requires spotting the new base type while doing bindings and
that is error prone [1][2].

This PR simply does let the `protected` constructor, using when chaining,
be generated normally. It's simpler and will cover all the cases (without
requiring hacks in the availability of those types)

[1] #7083
[2] #7084
@spouliot
Copy link
Contributor

Fixed in xcode11.1 with 6bdce2d

monojenkins pushed a commit to monojenkins/xamarin-macios that referenced this issue Sep 24, 2019
… .ctor

Types that are new in 64bits only OS are generated differently on 32bits
bindings. They mainly throw a `PlatformNotSupportedException` so it's
easier to diagnose (than a crash) what's happening at runtime.

This works well in all cases except one. When a new type, let's say
`UIMenuElement` is added **and** serves as a new base type for existing
types.

`UIKeyCommand` (iOS 7) -> `UICommand` (iOS 13)-> `UIMenuElement` (iOS 13)

This is _correct_ as new base types can be added (in ObjC and C#).
However the generated code for the constructors of `UICommand` and
`UIMenuElement` would be throwing a `PlatformNotSupportedException`
which breaks the `UIKeyCommand` on 32 bits devices.

We fixed this in a few places by tweaking the availability attribute
but that requires spotting the new base type while doing bindings and
that is error prone [1][2].

This PR simply does let the `protected` constructor, using when chaining,
be generated normally. It's simpler and will cover all the cases (without
requiring hacks in the availability of those types)

[1] xamarin#7083
[2] xamarin#7084
@LeoJHarris
Copy link

LeoJHarris commented Sep 24, 2019

@spouliot ETA when this will be available?

spouliot pushed a commit that referenced this issue Sep 25, 2019
… chaining .ctor (#7092)

Types that are new in 64bits only OS are generated differently on 32bits
bindings. They mainly throw a `PlatformNotSupportedException` so it's
easier to diagnose (than a crash) what's happening at runtime.

This works well in all cases except one. When a new type, let's say
`UIMenuElement` is added **and** serves as a new base type for existing
types.

`UIKeyCommand` (iOS 7) -> `UICommand` (iOS 13)-> `UIMenuElement` (iOS 13)

This is _correct_ as new base types can be added (in ObjC and C#).
However the generated code for the constructors of `UICommand` and
`UIMenuElement` would be throwing a `PlatformNotSupportedException`
which breaks the `UIKeyCommand` on 32 bits devices.

We fixed this in a few places by tweaking the availability attribute
but that requires spotting the new base type while doing bindings and
that is error prone [1][2].

This PR simply does let the `protected` constructor, using when chaining,
be generated normally. It's simpler and will cover all the cases (without
requiring hacks in the availability of those types)

[1] #7083
[2] #7084
@JohnHunterPartholan
Copy link

Hi,
I am getting the same exception in my app even though I am not using shell flyout. I can also replicate the issue with File/New/Blank Forms application.

My build config is

XF 4.1
Xamarin iOS 13.2.0.42
VS 2019 16.3
Xcode 11.0
Mac OS Mojave 10.14.6
Is there a timescale for the fix as development on my project has now ground to a halt?

Thanks.

@spouliot
Copy link
Contributor

The crash happens only on 32bits devices (or if you're building 32bits only on a old version of iOS that supports 32/64bits). Xamarin.Forms itself hits the issue when it calls UIKeyCommand.

At the moment the fix is only available of our upcoming Xcode11.1 branch. You can get a package directly from our bots here: https://bosstoragemirror.blob.core.windows.net/wrench/jenkins/xcode11.1/6bdce2dac8a3c3946c4e464af5e8355360d79dfc/12/package/notarized/xamarin.ios-13.3.0.6.pkg

This has not gone thru any formal tests, beside automated ones, but the branch is still very similar to the stable release.

Notes

  • It's also available from master but there are quite a few more changes there;
  • I do not know then the fix will be our stable channel;

@spouliot spouliot changed the title Shell Flyout crashes on iPad 2 and iOS 9.3 PlatformNotSupportedException on 32bits devices (e.g. iPad 2 and iOS 9.3) Sep 25, 2019
@xperseguers
Copy link
Author

Indeed, the changes are not big: xamarin-mac-6.2.0.42...xcode11.1

@xperseguers
Copy link
Author

Excellent! I confirm that my app is not crashing anymore! Thanks a bunch!

@JohnHunterPartholan
Copy link

Thanks this fix works.

@LeoJHarris
Copy link

@spouliot Does this work with Visual studio 2019 community or preview VS?

@xperseguers
Copy link
Author

@LeoJHarris Just install the package on top of the current stable channel of VS community and it will work.

@LeoJHarris
Copy link

LeoJHarris commented Sep 25, 2019

@spouliot We downloaded the package linked above onto our mac and installed that there and then prompted to install on windows machine on Visual studio start up connecting to the mac. When we run our app on a tablet running iOS 10.3 are still getting a PlatformNotSupportedException as shown below:

Can you please advise if we need to open a new ticket for this? This is a blocking issue for us.

2019-09-26 09:22:02.574 MyApp.iOS[945:184528] [AppCenterCrashes] ERROR: +[MSWrapperLogger MSWrapperLog:tag:level:]/10 Unhandled Exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.PlatformNotSupportedException: This API is not supported on this version of iOS
  at UIKit.UIMenuElement..ctor (System.IntPtr handle) [0x00007] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIMenuElement.g.cs:91 
  at UIKit.UICommand..ctor (System.IntPtr handle) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UICommand.g.cs:88 
  at UIKit.UIKeyCommand..ctor (System.IntPtr handle) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIKeyCommand.g.cs:91 
  at (wrapper managed-to-native) System.Reflection.RuntimeConstructorInfo.InternalInvoke(System.Reflection.RuntimeConstructorInfo,object,object[],System.Exception&)
  at System.Reflection.R
untimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:936 
   --- End of inner exception stack trace ---
  at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00018] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:944 
  at System.Reflection.RuntimeConstructorInfo.DoInvoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00086] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:926 
  at System.Reflection.RuntimeConstructorInfo.In
voke (System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:960 
  at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/corefx/src/Common/src/CoreLib/System/Reflection/ConstructorInfo.cs:22 
  at ObjCRuntime.Runtime.ConstructNSObject[T] (System.IntPtr ptr, System.Type type, ObjCRuntime.Runtime+MissingCtorResolution missingCtorResolution) [0x0003b] in <1b20576ce73640d782f136af13e79af3>:0 
  at ObjCRuntime.Runtime.GetNSObject[T] (System.IntPtr ptr) [0x000d1] in <1b20576ce73640d782f136af13e79af3>:0 
  at UIKit.UIKeyCommand.Create (Foundation.NSString keyCommandInput, UIKit.UIKeyModifierFlags modifierFlags, ObjCRuntime.Selector action) [0x0003b] in /Library/Frame
works/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIKeyCommand.g.cs:107 
  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement]..ctor () [0x00043] in <4e367b2cd46d4a02b980ea2aa2a1115b>:0 
  at Xamarin.Forms.Platform.iOS.Platform+DefaultRenderer..ctor () <0x18d7ee0 + 0x0004f> in <4e367b2cd46d4a02b980ea2aa2a1115b#f28c7bdbefdddcba928d508479031273>:0 
  at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00000] in d:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:187 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003d] in d:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:97 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in d:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:46 
  at Xamarin.Forms.Platform.iOS.PageRenderer.ViewDidLoad () [0x0008f] in d:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:238 
  at (wrapper managed-to-nativ
e) ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper(intptr,intptr)
  at UIKit.UIViewController.get_View () [0x0002a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIViewController.g.cs:3171 
  at Xamarin.Forms.Platform.iOS.PageRenderer.get_NativeView () [0x00000] in d:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:104 
  at Xamarin.Forms.Platform.iOS.PageRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x0003d] in d:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:120 
  at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in d:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:188 
  at Xamarin.Forms.Platform.iOS.NavigationRenderer.CreateViewControllerForPage (Xamarin.Forms.Page page) [0x00008] in d:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:358 
  at Xamarin.Forms.Platform.iOS.NavigationRenderer.OnPushAsync (Xamarin.Forms.Page page, System.Boolean animated) [0x0001d] in d:\a\1
\s\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:345 
  at Xamarin.Forms.Platform.iOS.NavigationRenderer.<ViewDidLoad>b__46_0 (Xamarin.Forms.Page p) [0x00024] in d:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:238 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021 
  at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/Foundation/NSAction.cs:178 
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIKit/UIAppl
ication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIKit/UIApplication.cs:65 
  at MyApp.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\Admin\Apps\MyApp\MyApp\MyApp.iOS\Main.cs:18 
2019-09-26 09:22:02.669 MyApp.iOS[945:184528] Unhandled managed exception: Exception has been thrown by the target of an invocation. (System.Reflection.TargetInvocationException)
  at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00018] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:944 
  at System.Reflection.RuntimeConstructorInfo.DoInvoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00086] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:926 
  at System.Reflection.RuntimeConstructorInfo.Invoke (System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globali
zation.CultureInfo culture) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:960 
  at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/corefx/src/Common/src/CoreLib/System/Reflection/ConstructorInfo.cs:22 
  at ObjCRuntime.Runtime.ConstructNSObject[T] (System.IntPtr ptr, System.Type type, ObjCRuntime.Runtime+MissingCtorResolution missingCtorResolution) [0x0003b] in <1b20576ce73640d782f136af13e79af3>:0 
  at ObjCRuntime.Runtime.GetNSObject[T] (System.IntPtr ptr) [0x000d1] in <1b20576ce73640d782f136af13e79af3>:0 
  at UIKit.UIKeyCommand.Create (Foundation.NSString keyCommandInput, UIKit.UIKeyModifierFlags modifierFlags, ObjCRuntime.Selector action) [0x0003b] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIKeyCommand.g.cs:107 
  at Xamarin.Forms.Platform.iOS.Visual
The app has been terminated.ElementRenderer`1[TElement]..ctor () [0x00043] in <4e367b2cd46d4a02b980ea2aa2a1115b>:0 
  at Xamarin.Forms.Platform.iOS.Platform+DefaultRenderer..ctor () <0x18d7ee0 + 0x0004f> in <4e367b2cd46d4a02b980ea2aa2a1115b#f28c7bdbefdddcba928d508479031273>:0 
  at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00000] in d:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:187 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003d] in d:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:97 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in d:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:46 
  at Xamarin.Forms.Platform.iOS.PageRenderer.ViewDidLoad () [0x0008f] in d:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:238 
  at (wrapper managed-to-native) ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper(intptr,intptr)
  at UIKit.UIViewController.get_View () [0x0002a] in /Libra

Failed to Stop app:  An error occurred on client IDB1630274 while executing a reply for topic xvs/idb/16.3.0.274/stop-app
ry/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIViewController.g.cs:3171 
  at Xamarin.Forms.Platform.iOS.PageRenderer.get_NativeView () [0x00000] in d:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:104 
  at Xamarin.Forms.Platform.iOS.PageRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x0003d] in d:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:120 
  at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in d:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:188 
  at Xamarin.Forms.Platform.iOS.NavigationRenderer.CreateViewControllerForPage (Xamarin.Forms.Page page) [0x00008] in d:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:358 
  at Xamarin.Forms.Platform.iOS.NavigationRenderer.OnPushAsync (Xamarin.Forms.Page page, System.Boolean animated) [0x0001d] in d:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:345 
  at Xamarin.Forms.Platform.iOS.NavigationRenderer.<ViewD
The app has been terminated.
idLoad>b__46_0 (Xamarin.Forms.Page p) [0x00024] in d:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:238 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021 
  at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/Foundation/NSAction.cs:178 
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegate
ClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIKit/UIApplication.cs:65 
  at MyApp.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\Admin\Apps\MyApp\MyApp\MyApp.iOS\Main.cs:18 
 --- inner exception ---
This API is not supported on this version of iOS (System.PlatformNotSupportedException)
  at UIKit.UIMenuElement..ctor (System.IntPtr handle) [0x00007] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIMenuElement.g.cs:91 
  at UIKit.UICommand..ctor (System.IntPtr handle) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UICommand.g.cs:88 
  at UIKit.UIKeyCommand..ctor (System.IntPtr handle) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIKeyCommand.g.cs:91 
  at (wrapper managed-to-native) System.Reflection.RuntimeConstructorInfo.InternalInvoke(System.Reflection.RuntimeConstruc
torInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:936 

@xperseguers
Copy link
Author

@LeoJHarris, this is much strange, your stack trace is full of iOS framework 13.2.0.42, which is the stable one. Sounds odd, but after downloading, you should obviously install it, and you should better do so closing first VS. After installing and going to about, full info, you should read that the iOS framework is now 13.3.0.6, and not 13.2.0.42!

@LeoJHarris
Copy link

LeoJHarris commented Sep 25, 2019

@xperseguers I see the issue now I didnt fully read the message the first time and I clicked install to quickly (simple mistake). But I reinstalled onto the mac again the version 13.3.0.6:

Capture

@spouliot However I cannot pair with mac now if I do not install previous stable version can you advise the work around?

@LeoJHarris
Copy link

LeoJHarris commented Sep 26, 2019

@spouliot Hi can you advise how we can use use 13.3.0.6? We have it installed on mac but Visual studio requires older and more stable Xamarin.ios of 13.2.0.42 for pairing. Please advice.

@JohnHunterPartholan
Copy link

I'm guessing this bug is going to break our CI builds until the XCode 11.1 release is issued?

@IkeRolfe
Copy link

IkeRolfe commented Sep 27, 2019

@LeoJHarris For now I was able to work around this issue by Using Visual Studio 2019 Preview, which installed and earlier version 12.x

@LeoJHarris
Copy link

Hi @IkeRolfe are you meaning that the Visual Studio 2019 preview you have is installed with older Xamarin.iOS 12.x ?

If I do a fresh install of preview 2019 then I think that will include the latest Xamarin.iOS.

@IkeRolfe
Copy link

@LeoJHarris I installed Preview 2019 today and it is still using 12.x for some reason.

@VincentDondain
Copy link
Contributor

Hi everyone, we just released Xamarin.iOS 13.4 to stable. Here are the release notes mention the regression fix specifically: https://docs.microsoft.com/en-us/xamarin/ios/release-notes/13/13.4

VincentDondain pushed a commit to VincentDondain/xamarin-macios that referenced this issue Oct 16, 2019
… .ctor (xamarin#7085)


Types that are new in 64bits only OS are generated differently on 32bits
bindings. They mainly throw a `PlatformNotSupportedException` so it's
easier to diagnose (than a crash) what's happening at runtime.

This works well in all cases except one. When a new type, let's say
`UIMenuElement` is added **and** serves as a new base type for existing
types.

`UIKeyCommand` (iOS 7) -> `UICommand` (iOS 13)-> `UIMenuElement` (iOS 13)

This is _correct_ as new base types can be added (in ObjC and C#).
However the generated code for the constructors of `UICommand` and
`UIMenuElement` would be throwing a `PlatformNotSupportedException`
which breaks the `UIKeyCommand` on 32 bits devices.

We fixed this in a few places by tweaking the availability attribute
but that requires spotting the new base type while doing bindings and
that is error prone [1][2].

This PR simply does let the `protected` constructor, using when chaining,
be generated normally. It's simpler and will cover all the cases (without
requiring hacks in the availability of those types)

[1] xamarin#7083
[2] xamarin#7084
@ghost ghost locked as resolved and limited conversation to collaborators May 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug If an issue is a bug or a pull request a bug fix iOS Issues affecting Xamarin.iOS
Projects
None yet
Development

No branches or pull requests

6 participants