Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MetadataUpdateHandlerAttribute #50954

Merged
merged 3 commits into from
Apr 9, 2021

Conversation

stephentoub
Copy link
Member

And at least the beginning of reflection cache clearing support.

Fixes #49361

cc: @tommcdon, @mikem8361, @steveharter, @pranavkm

@dotnet-issue-labeler
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

Copy link
Member

@mikem8361 mikem8361 left a comment

Choose a reason for hiding this comment

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

Other than a one comment, it looks good.

Looks like you also did the reflection caching clearing too. Thank!

And at least the beginning of reflection cache clearing support.
@stephentoub
Copy link
Member Author

stephentoub commented Apr 9, 2021

@pranavkm, I was just looking at dotnet-watch to see what we'll need to do there to respect this, and it seems like we likely first need Microsoft.CodeAnalysis.ExternalAccess.Watch.Api.WatchHotReloadService.Update augmented to include type names, then we can modify the manager to forward those to the agent, and then the agent can use those to resolve the Types to be passed to the update handlers? Or is the plan to parse the metadata delta in the agent to extract updated type information?

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

LGTM - just one comment about updating the ref file.

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>

// Create a new, empty cache to replace the old one and try to substitute it in.
var newCache = new RuntimeTypeCache(this);
if (ReferenceEquals(GCHandle.InternalCompareExchange(m_cache, newCache, existingCache), existingCache))
Copy link
Member

Choose a reason for hiding this comment

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

It should be enough to just set the GCHandle target to null. The GCHandle is weakhandle and so the code should be generally prepared to handle the null case.

#51070

@ghost ghost locked as resolved and limited conversation to collaborators May 11, 2021
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a notification mechanism for EnC and HotReload
7 participants