Re: .NET 4.8 DataGridView causes exception


Karl-Otto Rosenqvist
 

Hi again!
I just tested the .NET Framework v4.8 application with Narrator and there's no exception thrown so NVDA must be querying the controls for more or other interfaces than Narrator does.


Cheers!



Karl-Otto Rosenqvist
MAWINGU
Orgnr: 750804-3937
0701- 75 98 56
karl-otto@...
https://mawingu.se

Den 2020-08-31 kl. 23:33, skrev Karl-Otto Rosenqvist:

Hi!
No, not that project. You cannot just change from .NET Framework to .NET Core so I created a new solution with one .NET Core WinForms application and one .NET Framework WinForms application.
They just include one form with a DataGridView that is bound to an array at startup. The array contains 3 items with an int, a string and a date time property.
The .NET Core (version 3.1) application starts just fine and displays the grid with the three items.
The .NET Framework (version 4.8) throws an exception of the type I mentioned before. If I stop NVDA and run the application again it displays correctly. I can then start NVDA and move around in the grid just as one could expect.
I changed to .NET Framework 4.7.2 and the application starts just fine, no exception.
Conclution
There's a bug in .NET Framework 4.8 regarding the COM visibility that causes an exception to be thrown. If started without debugger the application runs as expected.
The problem seems to just appear during debugging so the impact on common users who just use an application is minor to none.
I've attached the solution with the two projects in a zip file if anyone would like to test, out of curiosity.
Kind regards
Karl-Otto
Karl-Otto Rosenqvist
MAWINGU
Orgnr: 750804-3937
0701- 75 98 56
karl-otto@...
https://mawingu.se
Den 2020-08-30 kl. 08:20, skrev Leonard de Ruijter:
Hello Karl-Otto,

I wonder, are you by any chance able to update  the project to .net core? It supports win forms as of version 3.

Regards,
Leonard

Op 29 aug. 2020 om 22:58 heeft Karl-Otto Rosenqvist <Karl-otto@...> het volgende geschreven:

Hi!
I just changed the .NET Framework version to 4.8 on a WinForms application I've created and when I ran it I got the following exception:

Managed Debugging Assistant 'NonComVisibleBaseClass'
  Message=Managed Debugging Assistant 'NonComVisibleBaseClass' : 'Ett QueryInterface-anrop utfördes med en begäran om klassgränssnittet för den COM-synliga hanterade klassen DataGridViewTextBoxCellAccessibleObject. QueryInterface-anropet kommer dock att misslyckas eftersom den här klassen härleds från klassen DataGridViewCellAccessibleObject som inte är synlig för COM. Detta förhindrar att basklasser som inte är synliga för COM begränsas av versioneringsreglerna för COM.'

Ok, it's in swedish but the main problem here seems to be that the class that the DataGridViewTextBoxCellAccessibleObject derives from isn't visible for COM and therefore the query interface call will fail.

Visual Studio breaks for this exception and even if I press F5 to keep running the exception is thrown again. If I quit NVDA and then press F5 the application starts and shows the DataGridView just fine. I then start NVDA and it seems to work as expected. There's some new information spoken as "Not sorted" that wasn't there when it was using an older .NET Framework.

I'm running Version: alpha-20775,9a4074bc.

Are there anything I can do to further investigate this or should I just file it as a bug? The problem seems to be related to the .NET FFramework 4.8 rather than NVDA.


Kind regards

Karl-Otto
--
Karl-Otto Rosenqvist
MAWINGU
Orgnr: 750804-3937
0701- 75 98 56
karl-otto@...
https://mawingu.se



Join nvda-devel@groups.io to automatically receive all group messages.