Skip to content

Conversation

gewarren
Copy link
Contributor

@gewarren gewarren commented Sep 23, 2021

Fixes #26021

Preview


## New behavior

The same code from the [Previous behavior](#previous-behavior) section produces an <xref:System.InvalidOperationException> with the following message:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous/new behavior sections don't show anything about the handle being created or not. Is there a way to show that in the code?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SergeySmirnov-Akvelon to confirm on that.

Copy link

@SergeySmirnov-Akvelon SergeySmirnov-Akvelon Sep 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially, the issue was reproduced only when the Handle was created. The presence of the Handle caused an additional thread of code to be called, which tried to access the Items and failed because access to Items in virtual mode was denied. The user did not see any information about the Handle, only an exception with access to Items.

Now, since the virtual mode is always checked, we also display an error only about the virtual mode, without any data about the Handle.

Copy link
Member

@dreddy-work dreddy-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@gewarren gewarren merged commit 9c48eeb into dotnet:main Sep 24, 2021
@gewarren gewarren deleted the listview branch September 24, 2021 17:48
@gewarren
Copy link
Contributor Author

Thanks for reviewing. This will go live probably tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WinForms] API validate if the ListVIew is in virtual mode and throws an InvalidOperationException

3 participants