'Cannot see event implementing interface in Visual Studio debugger

I have the following C# class:

public class SignInViewModel : ISwitchable
{
    IChildViewModelFactory _factory;
        
    // Implement ISwitchable interface.
    public event EventHandler<object> SwitchEvent;

    public SignInViewModel(IChildViewModelFactory factory)
    {
        _factory = factory;
    }
    ...
}

When I inspect value in the Visual Studio 2019 debugger, I cannot see the SwitchEvent field as a member:

((ISwitchable)value).SwitchEvent += ChildViewModel_SwitchEvent; // value is SignInViewModel instance.

I tried the following, but got the same result:

ISwitchable temp = (ISwitchable)value;
temp.SwitchEvent += ChildViewModel_SwitchEvent;

temp only shows the _factory and SignInViewModel() ctor as class members.

How can I see SwitchEvent, the event implementating the interface?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source