{"record":{"id":"926c803254ab7bc5","repo":"dotnet/maui","slug":"implement-inativeelementview-on-cell-renderer-co","errorCode":null,"errorMessage":"Implement INativeElementView on cell renderer: {ContentCell.GetType().AssemblyQualifiedName}","messagePattern":"Implement INativeElementView on cell renderer: (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Compatibility/Core/src/iOS/ContextActionCell.cs","lineNumber":77,"sourceCode":"\n\t\tpublic bool IsOpen\n\t\t{\n\t\t\tget { return ScrollDelegate.IsOpen; }\n\t\t}\n\n\t\tContextScrollViewDelegate ScrollDelegate\n\t\t{\n\t\t\tget { return (ContextScrollViewDelegate)_scroller.Delegate; }\n\t\t}\n\n\t\tElement INativeElementView.Element\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\tvar boxedCell = ContentCell as INativeElementView;\n\t\t\t\tif (boxedCell == null)\n\t\t\t\t{\n\t\t\t\t\tthrow new InvalidOperationException($\"Implement {nameof(INativeElementView)} on cell renderer: {ContentCell.GetType().AssemblyQualifiedName}\");\n\t\t\t\t}\n\n\t\t\t\treturn boxedCell.Element;\n\t\t\t}\n\t\t}\n\n\t\tpublic void Close()\n\t\t{\n\t\t\tif (_scroller == null)\n\t\t\t\treturn;\n\n\t\t\t_scroller.ContentOffset = new PointF(0, 0);\n\t\t}\n\n\t\tpublic override void LayoutSubviews()\n\t\t{\n\t\t\tbase.LayoutSubviews();\n","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Compatibility/Core/src/iOS/ContextActionCell.cs#L59-L95","documentation":"ContextActionCell.Element getter boxes ContentCell as INativeElementView and throws InvalidOperationException if it is not. The cell context-actions feature relies on the underlying cell renderer implementing INativeElementView so that the Xamarin Element can be retrieved; if the registered cell renderer type lacks that interface, context actions cannot function and the contract is broken.","triggerScenarios":"Using ContextActions on a Cell whose registered iOS cell renderer does not implement INativeElementView; a custom Cell renderer registered without INativeElementView; a ViewCell renderer replacement from a third party.","commonSituations":"Registering a custom cell renderer via [assembly: ExportCell] that forgets to implement INativeElementView; upgrading a renderer package that drops the interface; mixing ViewCell with custom renderers that bypass the default.","solutions":["Implement INativeElementView on the custom cell renderer (provide the Element property).","Verify the renderer type reported in the message; register or fix the correct renderer.","Avoid using ContextActions on cells whose renderers are not under your control."],"exampleFix":"// before\npublic class MyCell : UITableViewCell { /* no INativeElementView */ }\n// after\npublic class MyCell : UITableViewCell, INativeElementView\n{\n    public Element Element { get; set; }\n}","handlingStrategy":"type-guard","validationCode":"if (!(ContentCell is INativeElementView))\n    throw new InvalidOperationException($\"Cell renderer {ContentCell.GetType()} must implement INativeElementView to use ContextActions.\");","typeGuard":"static bool SupportsContextActions(UITableViewCell cell) => cell is INativeElementView;","tryCatchPattern":null,"preventionTips":["Implement INativeElementView on every custom cell renderer.","Verify the registered renderer type before using ContextActions.","Prefer built-in cell renderers when possible."],"tags":["maui","xamarin-forms","ios","cell-renderer","context-actions","invalidoperation"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}