Fix IL2026/IL3050 trim/AOT warnings in Data/ dynamic-query engine and Base/Reflection helpers - #77
Open
PrinceOliver wants to merge 2 commits into
Open
PrinceOliver wants to merge 2 commits into
PrinceOliver wants to merge 2 commits into
Conversation
added 2 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.
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
Fix IL2026 (RequiresUnreferencedCode) and IL3050 (RequiresDynamicCode) trim/AOT-analyzer warnings across the Syncfusion.Blazor.Toolkit Data/ dynamic-query engine (QueryableExtensions, DynamicQueryableExtensions, EnumerableExtensions, EnumerableOperation, QueryableOperation, DataOperations, DataUtil, DynamicObjectOperations, DataManager, Adaptors) and Base/Reflection helpers (FastReflectionExtension), by propagating [RequiresUnreferencedCode]/[RequiresDynamicCode] attributes from their true reflection/dynamic-code call sites up through the call graph to the correct architectural boundaries.
📝 Implementation Summary
Root causes identified
Verified against the actual BCL reference assemblies (via reflection probes) which .NET APIs used by this codebase carry
[RequiresUnreferencedCode]/[RequiresDynamicCode]:MethodInfo.MakeGenericMethod/Type.MakeGenericType— both attributesExpression.Property(Expression, string[, Expression[]]),Expression.PropertyOrField(Expression, string),Expression.Field(Expression, string)—RequiresUnreferencedCodeExpression.Call(Type/Expression, string, Type[], Expression[])(call-by-method-name) — both attributesType.GetType(string)—RequiresUnreferencedCode(Confirmed
Activator.CreateInstance(Type)andLambdaExpression.Compile()are not annotated in current .NET, so call sites using only those were left untouched.)What changed
CreateAccessor(PropertyInfo)/CreateAccessor(Type, string)annotated (both callType.MakeGenericType).OrderBy/OrderByDescending/ThenBy/ThenByDescending/Select/Skip/Take/Where/Predicate/Sum/Average/Max/Min/GroupByMany/Equal/NotEqual/GreaterThan*/LessThan*) plus their private helpers (GetValueExpression,GetExpression,GetLambdaWithComplexPropertyNullCheck, the privatePredicateoverload,CreateGeneric,EnumerableSumMethods/EnumerableAverageMethods).Average/Sum/Max/Min<TSource>(Int16 LINQ-provider methods) andInvokeParallel/GetParallelQuery.PerformSorting/PerformFiltering/PerformSearching/PerformGrouping/PerformSelect/PredicateBuilder/PerformAggregation/CastList/GroupSortingand their public wrappers.IAdaptor.PerformDataOperation<T>+ virtual impl) and BlazorAdaptor.cs (PerformDataOperation<T>override,DataOperationInvoke<T>,CollectChildRecords) — kept interface/base/override annotations consistent (the trimmer requires exactRequires*parity across interface members, base virtuals, and overrides — verified via build).ExecuteQuery/ExecuteQueryAsync/ProcessOfflineAsync, the public entry points of the dynamic-query engine, correctly serve as the stopping point for propagation withinData/. Callers inComponents/(out of scope for this task) will now surface their own IL2026/IL3050 warnings, which is the intended, honest outcome — those call sites do genuinely depend on the toolkit's dynamic-query capability.Scope boundary
Per the task, changes are confined to
src/Data/andsrc/Base/Reflection/.src/Components/files that call into now-annotated APIs (e.g.FastReflectionExtension.CreateAccessorfrom Chart renderers) are intentionally left as-is; they will surface new IL2026/IL3050 warnings that a follow-up task can address if desired.💡 Key Technical Decisions
✅ Verification Results
🔍 Quality Checklist
📸 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]