-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Use MetadataUpdateHandlerAttribute to clear Mono's reflection cache #50978
Comments
Tagging subscribers to this area: @CoffeeFlux Issue DetailsRelated CoreCLR work #50938 (the attribute was added as part of #50954). The slightly interesting thing for Mono is that we'll need to call down to reflection.c to clear to the unmanaged hash tables that map unmanaged metadata method representations to their managed counterparts. Enable the tests in #50954 Part of #44806
|
We actually also run into this trying to support the I have kind of a bad plan to fix it: I think what we need to do is to change typedef struct {
gpointer item;
MonoClass *refclass;
} ReflectedEntry;
in `reflection-cache.h` to
```c
typedef struct {
gpointer item;
MonoClass *refclass;
uint32_t generation; /* 0 is normal; hot reload may change it */
} ReflectedEntry; and then change Then the rest of the caching machinery will create the new entry. So this will be correct, but it's gonna be calling So if we do this, then we don't actually need the metadata update handler to do anything - all the work will be done by the reflection object lookup code. But the cost is an extra An alternative is to stop using the I don't think we want to ever change what I think it might be possible, however, to sometimes clear all the entries in the outdated concurrent hash (the weak hash we can probably just leave alone and let the GC clear the managed objects) when we discover it's no longer the latest one. In this case too, the metadata update handler won't be clearing anything. The issue is that (especially with generics) it's really hard to find all the relevant But making sure we always do the lookup in an up to date hash table seems doable... |
Fixes #56626 Fixes #50978 * Add mono hot reload support for updating parameter name * Add a debugger test * Don't invalidate the whole assembly when using hot reload * don't ignore reflection cache entries when the "no invalidate" flag is set --------- Co-authored-by: Aleksey Kliger <alklig@microsoft.com>
Related CoreCLR work #50938 (the attribute was added as part of #50954).
The slightly interesting thing for Mono is that we'll need to call down to reflection.c to clear to the unmanaged hash tables that map unmanaged metadata method representations to their managed counterparts.
Also need to clear the
Cache
inRuntimeType
added by #78840Enable the tests in #50954
Part of #44806Part of #57365The text was updated successfully, but these errors were encountered: