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.

Can't access interface properties

See original GitHub issue

Describe the bug Accessing many properties of interfaces exposed by Avalonia are not possible since #11062 with no alternatives.

To Reproduce Calling window.PlatformImpl?.DesktopScaling or any property of IPlatformImpl is not possible. Basically any interface that has suffix Impl cannot be used anymore, even when exposed from a public property.

Issue Analytics

  • State:open
  • Created 5 months ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
adirh3commented, Apr 28, 2023

I understand now that these changes were intentional, and I don’t mind the change of hiding these interfaces. I think that if you should change these public properties to private as well, e.g. PlatformImpl as it’s super confusing for users to have access to a property with instance that has zero accessible members.

0reactions
grokyscommented, Apr 27, 2023

I think this may be unintentional, since IWindowBaseImpl, ITopLevelImpl, are public interfaces

Nope, that’s the problem - they’ve always been considered by us to be unstable interfaces, but because we’ve never enforced any sort of access control on them, people have been using them as public interfaces without realizing (and these interfaces are old [^1] and by this point incredibly hacked together). We have our hands tied when making changes to Avalonia because of this.

Having said that, we’re listening to feedback and will adjust our approach based on that, they’re preview releases for a reason after all 😉

[^1]: Yep, that’s pre-0.0.1-alpha

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Cannot access implemented property (from interface)
I have an interface with properties: public interface IEntityModifier { ... bool AutoDetachOnFinished { get; set; } ...
Read more >
Interface Properties - C# Programming Guide
Interface properties typically don't have a body. The accessors indicate whether the property is read-write, read-only, or write-only. Unlike in ...
Read more >
Can't access property of interface to reference type in ...
In typescripts philosophy interface is virtual construction and you cant deal with it in any form except extending and inheritance (in other ...
Read more >
Understanding and using interfaces in TypeScript
Read-only properties in interfaces. Read-only properties cannot be changed once they are initialized. For example, the properties length , width ...
Read more >
c# - Implementing an interface when you don't need one of ...
There is no better interface to use. For instance, I have a class that allows you access items by index, check if it...
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