Cache is never populated in ComponentDesigner.ShadowPropertyCollection.cs
See original GitHub issue.NET version
8.0.0-alpha.1.22559.2
However, the situation I am reporting is not tied to a specific .NET version.
Did it work in .NET Framework?
No
Did it work in any of the earlier releases of .NET Core or .NET 5+?
no
Issue description
The ShadowPropertyCollection class contains a private field called _descriptors
which, if I understand the original intent correctly, is supposed to be used as a cache of PropertyDescriptor
. The flow is supposed to be like this:
- the first-time a given property descriptor is requested, the value is calculated in the
private PropertyDescriptor GetShadowedPropertyDescriptor(string propertyName)
private method - this value is added to the cache
- if the same property descriptor is subsequently requested the cached value is returned
However, what I observe when reading the code of this private method is that the calculated value is NOT added to the cache and therefore it is re-calculated each time the same descriptor is requested.
@elachlan, @dreddy-work and myself had a discussion about this and we concluded that it made more sense to raise a separate issue about this rather than simply fix it as part of #8222.
If the conclusion is that we want to fix the flawed logic, I will be happy to volunteer a PR.
Steps to reproduce
To be clear, the current logic works without problem and returns the expected result. It’s just that we pay a performance penalty if the same descriptor is requested multiple times.
Issue Analytics
- State:
- Created 10 months ago
- Comments:10 (10 by maintainers)
Top GitHub Comments
We’d like to do a bit of investigation on the VS side of things so we can make sure that we don’t run into something unexpected.
We haven’t got chance to go over this yet. It may have to wait for some more time.