Repository navigation
[Accessibility] Fixing ComboBoxAccessibleObject issue when Narrator and Inspect don't respond - #3524
Conversation
|
This bug was added when 423b2bc was merged. @hughbe, @JeremyKuhne |
|
I’m sorry I don’t know if this right? Can’t understand why removing ComImport would fix things... this is a com import |
|
@AaronRobinsonMSFT is there perhaps something funky with putting [ComImport]
[Guid("D6DD68D1-86FD-4332-8666-9ABEDEA2D24C")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IRawElementProviderSimple {}
[ComImport] // <-- broke things??
[Guid("1d5df27c-8947-4425-b8d9-79787bb460b8")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IRawElementProviderHwndOverride : IRawElementProviderSimple {} |
Not that I know of. However, MIDL_INTERFACE("1d5df27c-8947-4425-b8d9-79787bb460b8")
IRawElementProviderHwndOverride : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE GetOverrideProviderForHwnd(
/* [in] */ __RPC__in HWND hwnd,
/* [retval][out] */ __RPC__deref_out_opt IRawElementProviderSimple **pRetVal) = 0;
};Even if it was, the inheriting interface needs to be declared in the derived type. Can't find a good link, but in general it would be something like: interface IFoo
{
void Bar();
}
interface IFoo2 : IFoo
{
new void Bar();
void Baz();
} |
|
Sigh... I just looked at |
|
Cref #3231 which should fux |
|
@hughbe We need to be careful about changing this type. This is a breaking change from the .NET side of things even if it is wrong with respect to the actual COM types. @RussKie and @JeremyKuhne What are your thoughts on this breaking change? I have no opinion either way. Let's just make sure we understand the user impact. |
Ugh, sorry I missed this. :)
As we've documented it as deriving we should probably leave it that way. We can just comment fully as to the weirdness with this particular instance in the code so we handle it more carefully in the future. |
|
If the accessibility tools continue to function (such as Narrator and Accessibility Insights) I think we can take the change. /cc: @merriemcgaw |
Is this a breaking change? AFAICT it’s an internal interop type |
|
Yes, you're right - all these types live in |
|
If that is true, where is the type described by the referenced documentation above? |
I believe these docs are from WPF: https://github.com/dotnet/wpf/blob/ae1790531c3b993b56eba8b1f0dd395a3ed7de75/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationProvider/System/Windows/Automation/Provider/IRawElementProviderHwndOverride.cs |
Ah. Okay. Then this seems like changing the definition for WinForms is appropriate since it is an internal implementation detail. |
|
Testers approved these changes ✔️ |
| /// </summary> | ||
| [ComImport] | ||
| [Guid("1d5df27c-8947-4425-b8d9-79787bb460b8")] | ||
| [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] |
There was a problem hiding this comment.
I don't think this is right, if ComImport is removed the others should also be removed for consistency (i.e. make it a purely managed interface), otherwise you risk the dotnet runtime or tooling doing the wrong thing (you don't own the interface declaration, so it must be import or nothing to my knowledge, I think all other code paths in the runtime either disable COM interop or are related to ComVisible in various variants and thats a dangerous path to go down when you are not the owner)
I think we switched all projects to [assembly: ComVisible(false)] so the default behavior of not having ComImport should be not exposing the interface through COM interop? Did anyone test if this interface is still used by Narrator/Inspect when making it purely managed? For what its worth you may just have disabled the interface for COM interop, meaning its equivalent of not implementing it in the first place.
There was a problem hiding this comment.
I'm not sure I follow. [ComImport] itself doesn't expose it, it just generates a RCW/CCW if you pass the implementing class through interop.
From what I read we should remove the derivation, not the [ComImport] if we're exposing the implementing objects in any way to native. Or am I missing something?
There was a problem hiding this comment.
I'm generally just uncomfortable with removing [ComImport] without removing the GUID referring to an interface you don't own, considering the default if no [ComImport] is given would be an implicit [ComVisible(true)] meaning you claim that you own the interface.
That should not happen since we specified the assembly-level ComVisible(false) attribute but personally I don't understand all the code paths, a lot of logic just defaults to assuming non-import interfaces means the assembly owns the declaration. Any such decision must be avoided since it would be wrong.
To my understanding with this PR the [Guid]/[InterfaceType] attributes are now no longer having any effect so can and should be removed together with [ComImport]. If I'm missing something and the other two attributes are still doing something I'd like to know what happens, because I suspect it might just superficially work but might be wrong when looking at it in detail.
TLDR: to me it looks like this is now a plain managed interface and not performing any interop purpose besides forcing a base interface implementation, so the other two attributes should be removed together with ComImport to prevent mistaking the interface for something it isn't
|
I'm not even sure that this fix is working properly, I can't click around items in the combobox drop downs in our test application when inspect is running, at some point inspect hangs. |
|
@RussKie to keep an eye on this one too. |
|
@JeremyKuhne, @AaronRobinsonMSFT -
I experimented like this:
These results don't make sense to me. I think we are covering up a bigger issue here. Do you have any suggestions? |
|
@Tanya-Solyanik @hughbe @JeremyKuhne I truthfully am unclear on what is going on here. All I noted was the type definition isn't correct. Can someone create a minimal example that I can debug? |
|
@AaronRobinsonMSFT, I use the internal test forms in our project. ../tests/integration/WinformsControlsTest It's comfortable to make changes in the code and just run the test project without moving any dlls. |
|
@vladimir-krestov Unfortunately I can't really use Narrator so am having a tough time reproducing this issue. I am on Remote Desktop from a mac and that doesn't seem to work with Narrator. Any way we could reduce the issue to some other approach? I will try a few other things as well. |
|
@AaronRobinsonMSFT, can you use Inspect? |
|
@vladimir-krestov I stand corrected. I am able to use Narrator - was a setting on the macOS RDP client. On the above example, I am able to hear it say "ComboBox". Can we elaborate on what I should or shouldn't hear? |
|
@AaronRobinsonMSFT, Narrator and Inspect don't respond if to click to an edit field of a ComboBox. |
|
I am also able to hear the Narrator enumerate each element in the ComboBox when expanded as well as state the count. |
|
This isn't working at all. In fact by removing the Someone from WinForms or with far more experience/knowledge of the Accessibility API needs to actually debug the implementation instead of just making sure it doesn't crash. I can help out, but this doesn't seem like a specific COM issue since the interface itself appears very straight forward. If someone can point to a specific COM interop issue I am more than willing to investigate but the current issue is simply using this Accessibility interface in general. |

Fixes #3452
Proposed changes
[ComImport]attributeCustomer Impact
Regression?
Risk
Screenshots
Before
After
Test methodology
Accessibility testing
Test environment(s)
Microsoft Reviewers: Open in CodeFlow