Problem
The three public generic helper methods in src/Mono.Android/Android.App/FragmentManager.cs — FindFragmentById<T>, FindFragmentByTag<T>, and GetFragment<T> — are shipped public API on Mono.Android.dll but have no /// XML documentation. As a result they surface with no IntelliSense summaries or [learn.microsoft.com]((learn.microsoft.com/redacted) content for consumers. Documenting all three fully documents this hand-written file.
Location
- File(s):
src/Mono.Android/Android.App/FragmentManager.cs
- Line(s): 8–33 (the
FindFragmentById<T>, FindFragmentByTag<T>, and GetFragment<T> methods)
Current Code
using Android.OS;
using Android.Runtime;
using System.Diagnostics.CodeAnalysis;
#if ANDROID_11
namespace Android.App {
public partial class FragmentManager {
public T? FindFragmentById<
[DynamicallyAccessedMembers (Constructors)]
T
> (int id)
where T : Fragment
{
return FindFragmentById (id).JavaCast<T> ();
}
public T? FindFragmentByTag<
[DynamicallyAccessedMembers (Constructors)]
T
> (string tag)
where T : Fragment
{
return FindFragmentByTag (tag).JavaCast<T> ();
}
public T? GetFragment<
[DynamicallyAccessedMembers (Constructors)]
T
> (Bundle bundle, string key)
where T : Fragment
{
return GetFragment (bundle, key).JavaCast<T> ();
}
}
}
#endif
Suggested Fix
Add a complete /// doc comment (<summary>, <typeparam>, <param>, <returns>) above each of the three methods. These are strongly-typed .NET-for-Android overloads that call the corresponding non-generic base method and cast the result to T via JavaCast<T> (returning null when nothing matches). Do not change any code — this is a comment-only change.
using Android.OS;
using Android.Runtime;
using System.Diagnostics.CodeAnalysis;
#if ANDROID_11
namespace Android.App {
public partial class FragmentManager {
/// <summary>
/// Finds a <see cref="Fragment"/> that was identified by the given id, either when
/// inflated from XML or as the container id when added in a transaction, and returns
/// it cast to <typeparamref name="T"/>.
/// </summary>
/// <typeparam name="T">The <see cref="Fragment"/> type to cast the result to.</typeparam>
/// <param name="id">The resource id or container id used to identify the fragment.</param>
/// <returns>
/// The matching fragment cast to <typeparamref name="T"/>, or <see langword="null"/>
/// if no matching fragment exists.
/// </returns>
public T? FindFragmentById<
[DynamicallyAccessedMembers (Constructors)]
T
> (int id)
where T : Fragment
{
return FindFragmentById (id).JavaCast<T> ();
}
/// <summary>
/// Finds a <see cref="Fragment"/> that was identified by the given tag, either when
/// inflated from XML or as supplied when added in a transaction, and returns it cast
/// to <typeparamref name="T"/>.
/// </summary>
/// <typeparam name="T">The <see cref="Fragment"/> type to cast the result to.</typeparam>
/// <param name="tag">The tag used to identify the fragment.</param>
/// <returns>
/// The matching fragment cast to <typeparamref name="T"/>, or <see langword="null"/>
/// if no matching fragment exists.
/// </returns>
public T? FindFragmentByTag<
[DynamicallyAccessedMembers (Constructors)]
T
> (string tag)
where T : Fragment
{
return FindFragmentByTag (tag).JavaCast<T> ();
}
/// <summary>
/// Retrieves the current <see cref="Fragment"/> instance for a reference previously
/// placed in <paramref name="bundle"/> with <c>PutFragment</c>, and returns it cast
/// to <typeparamref name="T"/>.
/// </summary>
/// <typeparam name="T">The <see cref="Fragment"/> type to cast the result to.</typeparam>
/// <param name="bundle">The bundle in which the fragment reference was stored.</param>
/// <param name="key">The name of the entry in the bundle.</param>
/// <returns>
/// The referenced fragment cast to <typeparamref name="T"/>, or <see langword="null"/>
/// if no fragment is associated with the given key.
/// </returns>
public T? GetFragment<
[DynamicallyAccessedMembers (Constructors)]
T
> (Bundle bundle, string key)
where T : Fragment
{
return GetFragment (bundle, key).JavaCast<T> ();
}
}
}
#endif
Guidelines
- Follow dotnet/android formatting: tabs for indentation, a space before
(.
- This is a comment-only change — do not modify method signatures, bodies, the
#if ANDROID_11 guard, the [DynamicallyAccessedMembers (Constructors)] annotations, or any other code.
- Keep the wording aligned with the Android platform reference for [
FragmentManager]((developer.android.com/redacted)
- Every
<typeparam>/<param> must be documented so no CS1573 is introduced (these are suppressed in Mono.Android.csproj, but keep the docs complete anyway).
Acceptance Criteria
Fix-finder metadata
- Script:
04-missing-xml-docs
- Score:
30/30 (actionability: 10, safety: 10, scope: 10)
Generated by Nightly Fix Finder · 169.8 AIC · ⌖ 30.7 AIC · ⊞ 9.3K · ◷
Problem
The three public generic helper methods in
src/Mono.Android/Android.App/FragmentManager.cs—FindFragmentById<T>,FindFragmentByTag<T>, andGetFragment<T>— are shipped public API onMono.Android.dllbut have no///XML documentation. As a result they surface with no IntelliSense summaries or [learn.microsoft.com]((learn.microsoft.com/redacted) content for consumers. Documenting all three fully documents this hand-written file.Location
src/Mono.Android/Android.App/FragmentManager.csFindFragmentById<T>,FindFragmentByTag<T>, andGetFragment<T>methods)Current Code
Suggested Fix
Add a complete
///doc comment (<summary>,<typeparam>,<param>,<returns>) above each of the three methods. These are strongly-typed .NET-for-Android overloads that call the corresponding non-generic base method and cast the result toTviaJavaCast<T>(returningnullwhen nothing matches). Do not change any code — this is a comment-only change.Guidelines
(.#if ANDROID_11guard, the[DynamicallyAccessedMembers (Constructors)]annotations, or any other code.FragmentManager]((developer.android.com/redacted)<typeparam>/<param>must be documented so noCS1573is introduced (these are suppressed inMono.Android.csproj, but keep the docs complete anyway).Acceptance Criteria
FindFragmentById<T>,FindFragmentByTag<T>,GetFragment<T>) have complete///XML docs with<summary>,<typeparam>,<param>for every parameter, and<returns>.Mono.Androidbuilds successfully.Fix-finder metadata
04-missing-xml-docs30/30(actionability:10, safety:10, scope:10)