Watch/QuickWatch should disambiguate base EIMI and the reimplementation(s)
- Dominant language
- C#
- Stars
- 20.7k
- Forks
- 4.3k
- PR merge metrics
- PR metrics pending
Description
## Summary
As the title says.
## Background and Motivation
Suppose
```csharp
public interface IFace { int Prop { get; } }
public class Base : IFace
{
public int Prop => 1;
int IFace.Prop => 2;
}
public class Derived : Base, IFace
{
public new int Prop => 3;
int IFace.Prop => 4;
}
```
Currently Watch/QuickWatch shows (JMC disabled)
Note here the `class` properties `Prop` are disambiguated, but the explicit interface implementations have the same name.
## Proposed Feature
The base version of `IFace.Prop` can be annotated with ` (unreachable, Base)`.
- It disambiguates which is which.
- It highlights the fact that the base EIMI is not reachable by any C# construct.
Specifically, ` (unreachable, B)` is added to `I.M` if and only if
- `B` provides an *explicit* implementation of a gettable interface property `I.M` (it is this implementation that might be annotated) and
- the implementation of `I.M` on the actual type `D` of the object under inspection is not the implementation from `B`, regardless of whether the implementation on `D` is explicit or implicit.
## Alternative Designs
**Alt 0.** Say `unspeakable` instead of `unreachable`.
**Alt 1.** Just say ` (Base)` without `unreachable`. Downside: Not clear enough.
**Alt 2.** Do not display the base EIMI at all in Watch/QuickWatch. Downside: Sometimes, the developer might accidentally reimplement an interface and this could lead to unexpected behaviors in some code paths. Since this is in the debugger, highlighting this fact could help the developer think about possible consequences of reimplementing the interface.
Related: [dotnet/runtime#129952 (comment to issue)](https://github.com/dotnet/runtime/issues/129952#issuecomment-4839335796), [Developer Community ticket](https://developercommunity.microsoft.com/t/DebuggerBrowsable-on-Base-explicit-i/11114651).
Contributor guide
Research direction
Start by locating the Watch and QuickWatch display path that formats explicit interface implementations, then inspect how the actual type and its base types are represented. Reproduce the sample with Base and Derived to compare both EIMIs. Done means the base implementation is annotated only when the inspected type uses a different implementation, with the requested disambiguating wording.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- developer-experience, devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100