question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:open
  • Created 10 months ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
merriemcgawcommented, Dec 14, 2022

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.

1reaction
dreddy-workcommented, Dec 8, 2022

We haven’t got chance to go over this yet. It may have to wait for some more time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cache is never populated in ComponentDesigner. ...
Windows Forms is a .NET UI framework for building Windows desktop applications. - Cache is never populated in ComponentDesigner.ShadowPropertyCollection.cs ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found