-
Notifications
You must be signed in to change notification settings - Fork 549
Closed
Labels
bugIf an issue is a bug or a pull request a bug fixIf an issue is a bug or a pull request a bug fixmsbuildIssues affecting our msbuild tasks/targetsIssues affecting our msbuild tasks/targetsregressionThe issue or pull request is a regressionThe issue or pull request is a regressionwindows-onlyThe issue only occur on WindowsThe issue only occur on Windows
Milestone
Description
Apple platform
iOS
Framework version
net9.0-*
Affected platform version
VS 17.14.3 - VS 17.14.15, .net9.0-ios
Description
We are working to move our iOS app from net8.0-ios to net9.0-ios and have run into a blocking issue with a runtime error. My iOS solution is getting a 'NSInternalInconsistencyException Reason: (null)' when my xib and related files are located in a secondary Library project. I have attached a sample project below that creates this error.
This is only an issue when TargetFramework is net9.0-iOS.
- When the TargetFramework is net8.0-ios, this issue does not exist.
- When the xib and related files are located in the Execute project, this issue does not exit.
- I have tried multiple different versions of .NET9 (We plan to target 9.0.300)
- I have tried multiple different versions Visual Studio
- This has only become an issue in reason months. I have a build from June 22, 2025 that would have been built on .NET 9.0.203 and targeting .net9.0-ios that does not have this issue.
Steps to Reproduce
- Create a Solution with two iOS project, one with output type Exe and one with output type Library
- Add a Xib file and supporting c# files to the library project that inherit from UITableViewCell
- Create a new controller inheriting from UITableViewController
- override GetCell to Register the Nib for cell reuse and dequeue that reuseable cell
TableViewCell cell = (TableViewCell)tableView.DequeueReusableCell(TableViewCell.Key);
if (cell == null)
{
tableView.RegisterNibForCellReuse(TableViewCell.Nib, TableViewCell.Key);
cell = (TableViewCell)tableView.DequeueReusableCell(TableViewCell.Key);
}
return cell;
- Run project and see runtime error
See attached sample project.
Did you find any workaround?
Workarounds are to remain on .net8-ios or move all files to primary execute project. That is unfeasible for our production app.
Build logs
Stack track Error:
ObjCRuntime.ObjCException
Message=Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: (null)
Native stack trace:
0 CoreFoundation 0x00000001804c88c0 __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00000001800937cc objc_exception_throw + 72
2 CoreFoundation 0x00000001804c87d0 -[NSException initWithCoder:] + 0
3 UIKitCore 0x00000001857ce3c0 -[UINib instantiateWithOwner:options:] + 340
4 UIKitCore 0x0000000185e12578 -[UITableView _dequeueReusableViewOfType:withIdentifier:] + 456
5 UIKitCore 0x0000000185e12790 -[UITableView dequeueReusableCellWithIdentifier:] + 152
6 libxamarin-dotnet-debug.dylib 0x0000000110bfd58c xamarin_dyn_objc_msgSend + 160
7 iOSApp 0x00000001084b7528 wrapper_managed_to_native_ObjCRuntime_Messaging_NativeHandle_objc_msgSend_NativeHandle_intptr_intptr_ObjCRuntime_NativeHandle + 168
8 iOSApp 0x000000010756aae8 UIKit_UITableView_DequeueReusableCell_Foundation_NSString + 136
9 iOSApp 0x0000000103c50c34 iOSAppCommon_TableViewController_GetCell_UIKit_UITableView_Foundation_NSIndexPath + 532
10 iOSApp 0x00000001069b7818 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 296
11 libmonosgen-2.0.dylib 0x0000000110e5e744 mono_jit_runtime_invoke + 1548
12 libmonosgen-2.0.dylib 0x000000011101d498 mono_runtime_invoke_checked + 148
13 libmonosgen-2.0.dylib 0x000000011102107c mono_runtime_invoke + 540
14 libxamarin-dotnet-debug.dylib 0x0000000110bf43dc xamarin_invoke_trampoline + 5424
15 libxamarin-dotnet-debug.dylib 0x0000000110bfc264 xamarin_arch_trampoline + 148
16 libxamarin-dotnet-debug.dylib 0x0000000110bfd460 xamarin_arm64_common_trampoline + 64
17 UIKitCore 0x0000000185e56b58 -[_UIFilteredDataSource tableView:cellForRowAtIndexPath:] + 68
18 UIKitCore 0x0000000185e27e1c -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 1376
19 UIKitCore 0x0000000185dfa2bc -[UITableView _updateVisibleCellsForRanges:createIfNecessary:] + 540
20 UIKitCore 0x0000000185dfa8b0 -[UITableView _updateVisibleCellsNow:] + 1100
21 UIKitCore 0x0000000185e14fb8 -[UITableView layoutSubviews] + 144
22 UIKitCore 0x0000000186143218 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2420
23 QuartzCore 0x000000018b4e0974 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 424
24 QuartzCore 0x000000018b4eba44 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 132
25 QuartzCore 0x000000018b419a04 _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 484
26 QuartzCore 0x000000018b448658 _ZN2CA11Transaction6commitEv + 636
27 UIKitCore 0x0000000185bcd5c0 _UIApplicationFlushCATransaction + 80
28 UIKitCore 0x0000000185afe124 __setupUpdateSequence_block_invoke_2 + 356
29 UIKitCore 0x0000000185133f04 _UIUpdateSequenceRun + 76
30 UIKitCore 0x0000000185afd9b8 schedulerStepScheduledMainSection + 204
31 UIKitCore 0x0000000185afcdd4 runloopSourceCallback + 80
32 CoreFoundation 0x00000001804284b8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
33 CoreFoundation 0x0000000180428400 __CFRunLoopDoSource0 + 168
34 CoreFoundation 0x0000000180427b88 __CFRunLoopDoSources0 + 220
35 CoreFoundation 0x0000000180422584 __CFRunLoopRun + 780
36 CoreFoundation 0x0000000180421e3c CFRunLoopRunSpecific + 536
37 GraphicsServices 0x0000000190f62d00 GSEventRunModal + 164
38 UIKitCore 0x0000000185bcec98 -[UIApplication _run] + 796
39 UIKitCore 0x0000000185bd3064 UIApplicationMain + 124
40 libxamarin-dotnet-debug.dylib 0x0000000110bada94 xamarin_UIApplicationMain + 60
41 iOSApp 0x0000000108439ba0 wrapper_managed_to_native_UIKit_UIApplication_xamarin_UIApplicationMain_int_intptr_intptr_intptr_intptr_ + 176
42 iOSApp 0x00000001074d4844 UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 100
43 iOSApp 0x00000001074d4b78 UIKit_UIApplication_Main_string___System_Type_System_Type + 280
44 iOSApp 0x0000000103c4ebb8 Program__Main__string__ + 136
45 iOSApp 0x00000001069b7818 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 296
46 libmonosgen-2.0.dylib 0x0000000110e5e744 mono_jit_runtime_invoke + 1548
47 libmonosgen-2.0.dylib 0x000000011101d498 mono_runtime_invoke_checked + 148
48 libmonosgen-2.0.dylib 0x0000000111024704 mono_runtime_exec_main_checked + 116
49 libmonosgen-2.0.dylib 0x0000000110eb1728 mono_jit_exec + 364
50 libxamarin-dotnet-debug.dylib 0x0000000110bfc100 xamarin_main + 2032
51 iOSApp 0x0000000108869040 main + 64
52 dyld 0x00000001108913d8 start_sim + 20
53 ??? 0x0000000110632274 0x0 + 4569899636
54 ??? 0x0d69000000000000 0x0 + 966303595047682048
Source=<unknown>
StackTrace:
at UIKit.UITableView.DequeueReusableCell(NSString identifier) in /Users/builder/azdo/_work/1/s/macios/src/build/dotnet/ios/generated-sources/UIKit/UITableView.g.cs:line 267
at iOSAppCommon.TableViewController.GetCell(UITableView tableView, NSIndexPath indexPath) in C:\Users\kbedard\source\repos\iOSApp\iOSAppCommon\TableViewController.cs:line 39
Metadata
Metadata
Assignees
Labels
bugIf an issue is a bug or a pull request a bug fixIf an issue is a bug or a pull request a bug fixmsbuildIssues affecting our msbuild tasks/targetsIssues affecting our msbuild tasks/targetsregressionThe issue or pull request is a regressionThe issue or pull request is a regressionwindows-onlyThe issue only occur on WindowsThe issue only occur on Windows