Skip to content

fix(trim): clear IL2087 and IL2073 so the 7.3.2 NativeAOT build passes - #159

Merged
GabrielMarquezMatte merged 1 commit into
masterfrom
hotfix/7.3.2-trim
Oct 28, 2026
Merged

GabrielMarquezMatte merged 1 commit into
masterfrom
hotfix/7.3.2-trim

Conversation

@GabrielMarquezMatte

Copy link
Copy Markdown
Owner

Summary

The 7.3.2 release failed before publishing anything. Two bug-hunt fixes tripped the trim analyzers, which the NativeAOT publishes turn on for ExcelReader.Core with warnings as errors.

 SyncRowEnumerator.Box(T value)        // E5, non-generic IEnumerator.Current
-  RuntimeHelpers.GetUninitializedObject(typeof(T)) + raw write   // IL2087: needs ctor annotations on T
+  RuntimeHelpers.Box(ref Unsafe.As<T, byte>(ref value), typeof(T).TypeHandle)

 SheetDataReader.GetFieldType -> TypeOf(cell)   // E2
+  [return: DynamicallyAccessedMembers(PublicFields | PublicProperties)] on TypeOf   // IL2073

RuntimeHelpers.Box also boxes Nullable<T> correctly, which the raw write did not guarantee.

Evidence

  • Before: dotnet build src/ExcelReader.Core -c Release -p:EnableTrimAnalyzer=true -p:EnableAotAnalyzer=true fails with IL2087 (SyncRowEnumerator.cs:60) and IL2073 (SheetDataReader.cs:208), the same two errors as the release job.
    After: 0 errors. python python/scripts/build_native.py (the step that failed) publishes ExcelReader.Native.dll with no IL warnings. Test suite: 4020 / 4020.

Merge Danger

Door: two-way. Two internal edits, with no public API or behavior change.

Blast Radius: none.

After merge, v7.3.2 is re-tagged on the merge commit and the release re-runs. Nothing from the failed run reached NuGet, PyPI or crates.io.

SyncRowEnumerator boxed value-type models through
RuntimeHelpers.GetUninitializedObject(typeof(T)), which needs constructor
annotations on T; RuntimeHelpers.Box carries no trimming requirement and also
boxes Nullable<T> correctly. SheetDataReader.TypeOf now carries the same
DynamicallyAccessedMembers annotation as the GetFieldType it feeds. Both broke
builds that enable the trim and AOT analyzers on Core, such as the NativeAOT
publishes.

(cherry picked from commit b51be5f)
@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.10%. Comparing base (91a214e) to head (a7ac199).

Files with missing lines Patch % Lines
src/ExcelReader.Core/Parser/SyncRowEnumerator.cs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #159      +/-   ##
==========================================
- Coverage   92.11%   92.10%   -0.01%     
==========================================
  Files         285      285              
  Lines       23284    23282       -2     
  Branches     3771     3771              
==========================================
- Hits        21448    21445       -3     
- Misses       1247     1248       +1     
  Partials      589      589              
Flag Coverage Δ
cpp 89.61% <ø> (ø)
csharp 91.90% <0.00%> (-0.01%) ⬇️
python 96.80% <ø> (ø)
rust 92.18% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@GabrielMarquezMatte
GabrielMarquezMatte merged commit 8ef59c1 into master Oct 28, 2026
45 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant