Trim/AOT warning cleanup: Data/ dynamic-query engine, Base/ reflection helpers, HttpHandler/JSInteropAdaptor - #81
Open
PrinceOliver wants to merge 10 commits into
Open
PrinceOliver wants to merge 10 commits into
PrinceOliver wants to merge 10 commits into
Conversation
added 3 commits
September 22, 2026 03:34
…../1.0.0/net8.0/.toolversion.json, .../1.0.0/net9.0/.toolversion.json, package-lock.json, src/Base/SfBaseUtils.cs
… Base/Reflection helpers Propagates [RequiresUnreferencedCode]/[RequiresDynamicCode] attributes from the actual reflection/dynamic-code call sites (MethodInfo.MakeGenericMethod, Type.MakeGenericType, Expression.Property/PropertyOrField(Expression,string), Expression.Call(Type,string,Type[],Expression[])) up through the call graph to the correct architectural boundaries: - Base/Reflection/FastReflectionExtension.cs: CreateAccessor(...) overloads (Type.MakeGenericType). - Data/QueryableExtensions.cs and DynamicQueryableExtensions.cs: the ~90 public string-property-name based LINQ helpers (OrderBy/OrderByDescending/ThenBy/ ThenByDescending/Select/Skip/Take/Where/Predicate/Sum/Average/Max/Min/ GroupByMany/Equal/NotEqual/GreaterThan*/LessThan*) and their private helpers (GetValueExpression, GetExpression, GetLambdaWithComplexPropertyNullCheck, the private Predicate overload, CreateGeneric, EnumerableSumMethods/ EnumerableAverageMethods). - Data/EnumerableExtensions.cs: Average/Sum/Max/Min<TSource> (Int16 LINQ provider methods) and InvokeParallel/GetParallelQuery. - Data/EnumerableOperation.cs, QueryableOperation.cs, DataOperations.cs, DynamicObjectOperations.cs, DataUtil.cs: PerformSorting/PerformFiltering/ PerformSearching/PerformGrouping/PerformSelect/PredicateBuilder/ PerformAggregation/CastList/GroupSorting and their public wrappers. - Data/Adaptors/AdaptorBase.cs (IAdaptor.PerformDataOperation<T> + virtual impl) and BlazorAdaptor.cs (PerformDataOperation<T> override, DataOperationInvoke<T>, CollectChildRecords): kept interface/base/override Requires* annotations consistent (verified via build: no new IL2046/IL3051). - Data/DataManager.cs: ExecuteQuery/ExecuteQueryAsync/ProcessOfflineAsync, which are the public entry points of the dynamic-query engine and the correct stopping point for propagation within Data/ (Components/ callers are out of scope and will now surface their own IL2026/IL3050 warnings, which is expected/by design). Verified via : 0 errors, no new Requires*-attribute mismatches (IL2046/IL3051) introduced; the single pre-existing IL2046 in Components/Inputs/TextBox is untouched and unrelated.
Propagates [RequiresUnreferencedCode]/[RequiresDynamicCode] from the actual JsonSerializer.Serialize(object/object[], ...) call sites up to the correct architectural boundary within Data/: - Data/HttpHandler.cs: PrepareRequest(RequestOptions) and PrepareBatchRequest(RequestOptions, Type?), both of which serialize request payloads of statically-unknown shape. - Data/JSInteropAdaptor.cs: SyncfusionInterop.InvokeMethodAsync<T>, which serializes an arbitrary object[] of JS interop call arguments. Verified via build (net9.0): PrepareRequest/PrepareBatchRequest callers in DataManager.cs (ExecuteQuery<T>/ProcessOfflineAsync) already carry matching Requires* attributes, so no new warnings surface there. InvokeMethodAsync is called from Data/BaseComponent.cs (Dispose, Refresh, InvokeAsync helpers), which is NOT yet annotated -- this surfaces 6 new IL2026/IL3050 warning locations in BaseComponent.cs. This is expected: BaseComponent is the shared base for every Sf* component in the library, so propagating Requires* further requires a deliberate, larger follow-up (see PENDING tasks) rather than a one-line annotation, since it will cascade into every derived component's public API. Net effect of this commit alone: 17 warnings removed inside HttpHandler.cs/JSInteropAdaptor.cs, 12 new ones surfaced in BaseComponent.cs (net -5), with zero new IL2046/IL3051 Requires*-attribute mismatches.
added 7 commits
September 23, 2026 05:00
…or, NullableHelper, QueryableExtensions, DynamicQueryableExtensions
…Operation, QueryableOperation, Query
…ession-bodied properties in QueryableExtensions.cs
…tionExtension dynamic binder chain)
…fBaseComponent.InvokeAsync<T> through Charts interop call chains
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 Task Context
Make the Blazor Toolkit component library clean of Blazor-specific (BLxxxx), Roslyn analyzer, IL Trimmer (IL2xxx), and Native AOT (IL3xxx) warnings — preferring real trim/AOT-safety fixes (annotations, refactors) over suppression, and propagating [RequiresUnreferencedCode]/[RequiresDynamicCode] up the call chain to the correct architectural boundary when reflection/dynamic code genuinely can't be removed.
📝 Implementation Summary
Three verifiable batches landed on this branch, each rebuilt and diffed against the previous state to confirm no regressions:
1.
src/Base/SfBaseUtils.cs— replaced twoJsonSerializer-based round-trips with reflection-free equivalents:Equals<T>: array comparison now walks elements directly (ArraysEqual) instead of serializing both sides to JSON and comparing strings.ChangeType:TimeSpanconversion now usesTimeSpan.Parse(...)instead of a serialize/deserialize round-trip.This eliminates the warnings entirely (no annotation needed) — the strongest fix per the stated priority order.
2. Data/ dynamic-query engine + Base/Reflection helpers (
QueryableExtensions,DynamicQueryableExtensions,EnumerableExtensions,EnumerableOperation,QueryableOperation,DataOperations,DynamicObjectOperations,DataUtil,DataManager,Adaptors/AdaptorBase,Adaptors/BlazorAdaptor,Base/Reflection/FastReflectionExtension) — annotated the ~90 public string-property-name-based LINQ helpers and their private call chains with[RequiresUnreferencedCode]/[RequiresDynamicCode], propagated up toDataManager.ExecuteQuery/ExecuteQueryAsync/ProcessOfflineAsync(the public entry points of the dynamic-query engine — the correct stopping point withinData/).3.
src/Data/HttpHandler.cs+src/Data/JSInteropAdaptor.cs— annotatedPrepareRequest,PrepareBatchRequest, andSyncfusionInterop.InvokeMethodAsync<T>, all of which callJsonSerializer.Serializeon statically-unknown-shape payloads (request bodies / JS interop arguments). Verified their existing callers inDataManager.csalready carry matching Requires* attributes (no new warnings there).InvokeMethodAsyncis also called fromBaseComponent.cs(Dispose,Refresh, interop helpers), which is not yet annotated — see Human Review Required below.Net effect measured via
dotnet build -f net9.0before/after each batch: warnings removed at the true reflection/JSON call sites, with a small, deliberate, documented set of new warnings surfacing at un-annotated callers (expected — the analyzer is now honestly reporting the real risk instead of staying silent).💡 Key Technical Decisions
🔍 Quality Checklist
Please pay special attention to:
📸 Evidence & Outputs
Test Logs
dotnet build (Release, net9.0) after adding RequiresUnreferencedCode/RequiresDynamicCode annotations
dotnet build Syncfusion.Blazor.Toolkit.csproj -c Release -f net9.0 (exit 0) [877 bytes]