Skip to content

Invalid cast of CPListItem to CPListImageRowItem #15622

@janwiebe-jump

Description

@janwiebe-jump

As a continuation of #9996 here is a new issue.

Steps to Reproduce

  1. Use below SceneDelegate as a CarPlay scene delegate
  2. Load the app, and tap on an image of the horizontal row
  3. Get the exception

Expected Behavior

CPNowPlaying should be pushed to the stack and shown.

Actual Behavior

Exception:

Unable to cast object of type 'CarPlay.CPListItem' to type 'CarPlay.CPListImageRowItem'.
at ObjCRuntime.Runtime.GetNSObject[T] (System.IntPtr ptr) [0x00135] in <c07d1d2ff2fb499fb8eca9a33aeb3c2e>:0
  at ObjCRuntime.Trampolines+SDCPListImageRowItemHandler.Invoke (System.IntPtr block, System.IntPtr item, System.nint index, System.IntPtr completionBlock) [0x00016] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/ios/native/ObjCRuntime/Trampolines.g.cs:1635 
at (wrapper native-to-managed) ObjCRuntime.Trampolines+SDCPListImageRowItemHandler.Invoke(intptr,intptr,System.nint,intptr)
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.Type principalClass, System.Type delegateClass) [0x0003b] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:85 
at MyApp.iOS.Application.Main (System.String[] args) [0x00001] in /Users/user1/projects/MyApp/app/MyApp/MyApp.iOS/Main.cs:17

If I remove the await Task.Delay() call, it seems to work, but I need to do my async network calls to retrieve the actual data that is shown in the lists.

Environment

Version information
Visual Studio Community 2022 for Mac
Version 17.0.7 (build 7)
Installation UUID: 27bbd976-eba9-4528-9992-1e828471fd34

Runtime
.NET 6.0.5 (64-bit)
Architecture: Arm64

Roslyn (Language Service)
4.1.0-3.22075.3+592501cbb9c9394072a245c15b3458ff88155d85

NuGet
Version: 6.0.0.262

.NET SDK (Arm64)
SDK: /usr/local/share/dotnet/sdk/6.0.302/Sdks
SDK Versions:
	6.0.400-preview.22330.6
	6.0.302
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET SDK (x64)
SDK Version: 3.1.421

.NET Runtime (Arm64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	6.0.7
	6.0.6

.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/x64/dotnet
Runtime Version: 3.1.27

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

Updater
Version: 11

Apple Developer Tools
Xcode 13.4.1 (20504)
Build 13F100

Xamarin.Mac
Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.

Xamarin.iOS
Version: 15.10.0.5 (Visual Studio Community)
Hash: 96b3edb6d
Branch: d17-2
Build date: 2022-05-18 07:32:07-0400

Xamarin Designer
Version: 17.1.5.90
Hash: 53f47efde
Branch: remotes/origin/d17-0-vsmac
Build date: 2022-07-20 22:42:03 UTC

Xamarin.Android
Version: 12.3.3.3 (Visual Studio Community)
Commit: xamarin-android/d17-2/4e061b7
Android SDK: /Users/janwiebe/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		12.0 (API level 31)
		11.0 (API level 30)

SDK Command-line Tools Version: 5.0
SDK Platform Tools Version: 31.0.3
SDK Build Tools Version: 30.0.3

Build Information: 
Mono: dffa5ab
Java.Interop: xamarin/java.interop/d17-2@9760f0a9
ProGuard: Guardsquare/proguard/v7.0.1@912d149
SQLite: xamarin/sqlite/3.38.2@7b1e016
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-2@fc3c2ac

Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.12
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Eclipse Temurin JDK
Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk
1.8.0.302
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 17.2.0.37
Hash: 7f5a6ef
Branch: remotes/origin/d17-2
Build date: 2022-07-20 22:42:07 UTC

Android Device Manager
Version: 0.0.0.1116
Hash: e47e6c8
Branch: remotes/origin/d17-2
Build date: 2022-07-20 22:42:07 UTC

Build Information
Release ID: 1700070007
Git revision: 5a924af5432fc0ed4adc294eb2edb6a95c97cf2e
Build date: 2022-07-20 22:39:54+00
Build branch: release-17.0
Build lane: release-17.0

Operating System
Mac OS X 12.5.0
Darwin 21.6.0 Darwin Kernel Version 21.6.0
    Sat Jun 18 17:07:22 PDT 2022
    root:xnu-8020.140.41~1/RELEASE_ARM64_T6000 arm64

Build Logs

Example Project (If Possible)

CarPlaySceneDelegate.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    need-attentionAn issue requires our attention/response

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions