Problem
The public System.Linq.Extensions class and its two public ToEnumerable extension methods in src/Mono.Android/System.Linq/Extensions.cs ship in Mono.Android.dll but have no XML documentation. These are developer-facing helpers that let LINQ and foreach work over Java collection types (Java.Lang.IIterable), so consumers benefit from IntelliSense docs describing the behavior, parameters, return value, and the ArgumentNullException they can throw.
Location
- File(s):
src/Mono.Android/System.Linq/Extensions.cs
- Line(s): class declaration at line 10; non-generic
ToEnumerable at line 23; generic ToEnumerable<T> at lines 45–48
Current Code
public static class Extensions {
// ...
public static IEnumerable ToEnumerable (this Java.Lang.IIterable source)
{
if (source == null)
throw new ArgumentNullException ("source");
using (var iterator = source.Iterator ())
while (iterator.HasNext) {
yield return JavaConvert.FromJniHandle (
JNIEnv.CallObjectMethod (iterator.Handle, id_next),
JniHandleOwnership.TransferLocalRef);
}
}
// ...
public static IEnumerable<T?> ToEnumerable<
[DynamicallyAccessedMembers (Constructors)]
T
> (this Java.Lang.IIterable source)
{
if (source == null)
throw new ArgumentNullException ("source");
// ...
}
Note: the internal ToEnumerator_Dispose overloads in the same file are not part of the public API and should be left unchanged.
Suggested Fix
Add /// XML doc comments to the public class and both public ToEnumerable overloads only. Do not change any code, signatures, or behavior, and do not add #nullable enable. Use tabs for indentation to match the file.
Class summary (above public static class Extensions {):
/// <summary>
/// Provides LINQ-friendly extension methods for converting Java collection types
/// into managed <see cref="System.Collections.IEnumerable" /> sequences.
/// </summary>
public static class Extensions {
Non-generic overload (above public static IEnumerable ToEnumerable (this Java.Lang.IIterable source)):
/// <summary>
/// Returns an <see cref="System.Collections.IEnumerable" /> that iterates over a Java
/// <see cref="Java.Lang.IIterable" />, allowing <c>foreach</c> and LINQ to be used with Java
/// collection types. Each element is marshaled from its Java instance to the corresponding
/// managed type.
/// </summary>
/// <param name="source">The Java <see cref="Java.Lang.IIterable" /> to enumerate.</param>
/// <returns>An <see cref="System.Collections.IEnumerable" /> over the elements of <paramref name="source" />.</returns>
/// <exception cref="System.ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception>
public static IEnumerable ToEnumerable (this Java.Lang.IIterable source)
Generic overload (above the public static IEnumerable<T?> ToEnumerable<...> declaration):
/// <summary>
/// Returns an <see cref="System.Collections.Generic.IEnumerable{T}" /> that iterates over a Java
/// <see cref="Java.Lang.IIterable" />, marshaling each element to <typeparamref name="T" />. This
/// allows <c>foreach</c> and LINQ to be used with Java collection types.
/// </summary>
/// <typeparam name="T">The managed type to marshal each Java element to.</typeparam>
/// <param name="source">The Java <see cref="Java.Lang.IIterable" /> to enumerate.</param>
/// <returns>An <see cref="System.Collections.Generic.IEnumerable{T}" /> over the elements of <paramref name="source" />.</returns>
/// <exception cref="System.ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception>
public static IEnumerable<T?> ToEnumerable<
Guidelines
- Follow the existing XML-doc style used in
src/Mono.Android/Android.Graphics/Color.cs (<summary>, <param>, <returns>, <exception>, <see cref>), using tabs for indentation.
Java.Lang.IIterable corresponds to Java's [java.lang.Iterable]((developer.android.com/redacted)
- Comment-only change: do not alter signatures, logic, or add/remove
using directives, and do not touch the internal members.
Acceptance Criteria
Fix-finder metadata
- Script:
04-missing-xml-docs
- Score:
29/30 (actionability: 10, safety: 10, scope: 9)
Generated by Nightly Fix Finder for issue #11739 · 218 AIC · ⌖ 52.5 AIC · ⊞ 40.8K · ◷
Problem
The public
System.Linq.Extensionsclass and its two publicToEnumerableextension methods insrc/Mono.Android/System.Linq/Extensions.csship inMono.Android.dllbut have no XML documentation. These are developer-facing helpers that let LINQ andforeachwork over Java collection types (Java.Lang.IIterable), so consumers benefit from IntelliSense docs describing the behavior, parameters, return value, and theArgumentNullExceptionthey can throw.Location
src/Mono.Android/System.Linq/Extensions.csToEnumerableat line 23; genericToEnumerable<T>at lines 45–48Current Code
Suggested Fix
Add
///XML doc comments to the public class and both publicToEnumerableoverloads only. Do not change any code, signatures, or behavior, and do not add#nullable enable. Use tabs for indentation to match the file.Class summary (above
public static class Extensions {):Non-generic overload (above
public static IEnumerable ToEnumerable (this Java.Lang.IIterable source)):Generic overload (above the
public static IEnumerable<T?> ToEnumerable<...>declaration):Guidelines
src/Mono.Android/Android.Graphics/Color.cs(<summary>,<param>,<returns>,<exception>,<see cref>), using tabs for indentation.Java.Lang.IIterablecorresponds to Java's [java.lang.Iterable]((developer.android.com/redacted)usingdirectives, and do not touch theinternalmembers.Acceptance Criteria
Extensionsclass and both publicToEnumerableoverloads have///XML documentation.Fix-finder metadata
04-missing-xml-docs29/30(actionability:10, safety:10, scope:9)