Skip to content

Conversation

steveisok
Copy link
Member

This attribute is intended to be emitted only by Roslyn. The plan is for it to be used by reflection as a filter to "remove" types and members that have been deleted during a hot reload session.

Implements #118903

This attribute is intended to be emitted only by Roslyn. Its intent is to be used by reflection
as a filter to "remove" types and members that have been deleted during a hot reload session.

Implements dotnet#118903
@Copilot Copilot AI review requested due to automatic review settings September 11, 2025 15:09
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new MetadataUpdateDeletedAttribute that will be emitted by Roslyn to mark types and members as deleted during hot reload sessions. This attribute is designed to be used by reflection as a filter to "remove" types and members that have been deleted.

Key changes:

  • Adds the new MetadataUpdateDeletedAttribute class to the runtime
  • Updates reference assemblies to include the new attribute
  • Includes various compatibility suppressions that appear unrelated to the main change

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/libraries/System.Runtime.Loader/ref/System.Runtime.Loader.cs Adds the reference definition of MetadataUpdateDeletedAttribute
src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/MetadataUpdateDeletedAttribute.cs Implements the actual MetadataUpdateDeletedAttribute class with documentation
src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems Adds the new source file to the build
src/libraries/System.Collections.Specialized/src/CompatibilitySuppressions.xml Removes a comment line (unrelated to main change)
src/coreclr/nativeaot/System.Private.CoreLib/src/CompatibilitySuppressions.xml Adds various compatibility suppressions (unrelated to main change)
src/coreclr/System.Private.CoreLib/CompatibilitySuppressions.xml Adds compatibility suppressions for CoreCLR (unrelated to main change)

@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Sep 11, 2025
@steveisok
Copy link
Member Author

Even though the API was approved, this change should not be merged until dotnet/roslyn#80125 goes into Roslyn.

@steveisok steveisok added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Sep 11, 2025
@jkotas
Copy link
Member

jkotas commented Sep 11, 2025

Even though the API was approved, this change should not be merged until dotnet/roslyn#80125 goes into Roslyn.

I do not think this PR needs to wait for that. The support for this attribute is in Roslyn already.

Is the actual implementation of the filtering and tests coming to this PR?

@steveisok
Copy link
Member Author

Is the actual implementation of the filtering and tests coming to this PR?

I can - would prefer that actually. Wasn't sure if the preference was separate so started this way.

@jkotas
Copy link
Member

jkotas commented Sep 11, 2025

Yes, we prefer to have the API exposed, implemented and tested all in one PR.

@jeffhandley jeffhandley added area-System.Reflection.Metadata and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Sep 25, 2025
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-reflection
See info in area-owners.md if you want to be subscribed.

@tmat
Copy link
Member

tmat commented Sep 29, 2025

@jkotas @steveisok I pushed a commit addressing Jan's feedback.

A few hurdles:

  • I need to update Roslyn version that the tool that generates the deltas is using.
  • Roslyn currently doesn't support any changes to interface or virtual methods, so we can't easily test deleting overrides. I included them in the tests anyways so that it's easy to enable in future.
  • I was not able to build the runtime on my devbox, so wasn't able to actually run the tests and validate the impl. The linker hangs :(

@jkotas
Copy link
Member

jkotas commented Sep 29, 2025

I was not able to build the runtime on my devbox, so wasn't able to actually run the tests and validate the impl. The linker hangs :(

Yes, it is https://developercommunity.visualstudio.com/t/C-compiling-hangs-building-checked-bui/10974056 . It would help if you can comment on it to motivate folks to get it fixed faster.

It can be worked around by using debug build of the runtime (-rc debug) that is super slow for running libraries tests.

@tmat
Copy link
Member

tmat commented Sep 29, 2025

Updated HotReload utils to new Roslyn version: dotnet/hotreload-utils#619

@tmat
Copy link
Member

tmat commented Oct 1, 2025

@steveisok
Copy link
Member Author

@jkotas can you give this another pass? I think we're down to mono reflection quirks.

@jkotas
Copy link
Member

jkotas commented Oct 4, 2025

Looks good to me ... once all tests are green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Reflection NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants