You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SaveChangedAssemblyStep in AssemblyModifierPipeline unconditionally calls File.SetLastWriteTimeUtc(destination, DateTime.UtcNow) on every assembly it processes, even when the content is unchanged. This causes unnecessary downstream target re-runs on incremental builds.
Root Cause
In AssemblyModifierPipeline.cs, SaveChangedAssemblyStep.CopyIfChanged():
// NOTE: We still need to update the timestamp on this file, or this target would run againFile.SetLastWriteTimeUtc(destination.ItemSpec,DateTime.UtcNow);
This timestamp bump was added to prevent the calling target from re-running. However, _AfterILLinkAdditionalSteps (which calls AssemblyModifierPipeline with SourceFiles == DestinationFiles, i.e. in-place) uses flag files (_AndroidLinkFlag / _AdditionalPostLinkerStepsFlag) for its incrementalism — the per-assembly timestamp bumps are unnecessary for this target.
Impact
NativeAOT (confirmed)
For NativeAOT builds, @(ResolvedAssemblies) points directly to obj/Release/_Microsoft.Android.Resource.Designer.dll (no R2R intermediate copy). The in-place timestamp bump makes the designer DLL newer than CoreCompile's outputs, causing:
_GenerateJavaStubs re-runs → not skipped on incremental build
CoreCLR (suspected)
For CoreCLR, @(ResolvedAssemblies) points to R2R copies (obj/Release/.../R2R/*.dll), so CoreCompile is not affected. However, the bumped R2R timestamps may cause downstream targets (e.g., _RemoveRegisterAttribute via CopyIfChanged) to do unnecessary work on incremental builds.
Why CoreCLR appears unaffected
CoreCLR's R2R step copies assemblies to a separate directory before _AfterILLinkAdditionalSteps runs. The timestamp bump hits the R2R copies, not the original assemblies that CoreCompile references. NativeAOT has no R2R step, so the pipeline operates directly on the originals.
Suggested Fix
Review whether the timestamp bump is needed for each caller:
Activity
Skip NativeAOT incremental build test due to timestamp issue
[NativeAOT] Add GenerateNativeAotBootstrapSources task (#11255)
[NativeAOT] Fix incremental build test with trimmable type map (dotne…