Skip to content

Commit cde2184

Browse files
RedthCopilot
andcommitted
Correct ValidateContainerView doc example for the neutral TFM alias
The override example showed a backend-specific platform type as the parameter, but PlatformView is a per-TFM alias that resolves to System.Object on the non-platform build. An external backend copying the example verbatim gets CS0115 ("no suitable method found to override"), which is exactly what happened while writing the external backend test handler in this PR. Show the override taking `object` and testing the concrete wrapper type with a pattern match instead, and state the aliasing rule explicitly so the constraint is discoverable from the API docs rather than from a compiler error. Docs-only; no API or behavior change. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 58776f0 commit cde2184

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/Core/src/Handlers/View/ViewHandler.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,15 @@ protected void SetContainerView(PlatformView? containerView)
247247
/// <para>The .NET MAUI iOS, Mac Catalyst and Tizen handlers use this to require a
248248
/// <see cref="Platform.WrapperView"/>. An external backend that shadows <see cref="ContainerView"/> with its own
249249
/// wrapper type should do the same.</para>
250+
/// <para>Note that <paramref name="containerView"/> is typed as the platform view type of the target framework,
251+
/// which is <see cref="object"/> on the non-platform (neutral) build. An override must therefore match that type
252+
/// rather than the backend's own platform type, and test the concrete wrapper type with a pattern match.</para>
250253
/// <example>
251254
/// <code language="csharp">
252255
/// public new MyWrapperView? ContainerView => (MyWrapperView?)base.ContainerView;
253256
///
254-
/// protected override void ValidateContainerView(MyPlatformView containerView)
257+
/// // The parameter type is the target framework's platform view type - 'object' on the neutral build.
258+
/// protected override void ValidateContainerView(object containerView)
255259
/// {
256260
/// if (containerView is not MyWrapperView)
257261
/// {

0 commit comments

Comments
 (0)