Skip to content

Autocomplete using ComWrappers#6685

Merged
dreddy-work merged 3 commits intodotnet:mainfrom
kant2002:kant/autocomplete
Feb 22, 2022
Merged

Autocomplete using ComWrappers#6685
dreddy-work merged 3 commits intodotnet:mainfrom
kant2002:kant/autocomplete

Conversation

@kant2002
Copy link
Copy Markdown
Contributor

@kant2002 kant2002 commented Feb 12, 2022

Provide RCW for

  • IAutoComplete2

Provides CCW

  • IEnumString
Microsoft Reviewers: Open in CodeFlow

@kant2002 kant2002 requested a review from a team as a code owner February 12, 2022 06:45
@ghost ghost assigned kant2002 Feb 12, 2022
/// </summary>
public StringSource(string[] strings)
{
Array.Clear(strings, 0, size);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Based on the usage this will never ever happens.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Or better say, this is no-op.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

While it is true that there are no callers that pass in a null array, not clearing the passed in array is a change in behavior. I wouldn't remove the clear in this change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.


public void RefreshList(string[] newSource)
{
Array.Clear(strings, 0, size);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Also based on the usage this will never happens.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Or better say, this is no-op.


strings = newSource;
current = 0;
size = (strings is null) ? 0 : strings.Length;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this still needed then?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Line 78 - yes. But Line 80 definitely can be simplified, since strings never null.

RussKie
RussKie previously approved these changes Feb 16, 2022
@kant2002
Copy link
Copy Markdown
Contributor Author

Does this require additional review?

@dreddy-work
Copy link
Copy Markdown
Member

Does this require additional review?

Yes. @JeremyKuhne may want to look and merge. give it a day or two more.

{
private IntPtr _wrappedInstance;

public AutoCompleteWrapper(IntPtr wrappedInstance)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IAutoComplete2 has methods Init, Enable, SetOptions, and GetOptions. Here for AutoCompleteWrapper I only see Init and SetOptions. Is that intentional?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. This is intentional. There no need for declaring methods in RCW if they would not be used in the application. WinForms use just 2 methods, so I leave only these 2 method. That mentality was shown for me in the dotnet/runtime repo, and based on my experience working with WinForms team, same applied here as well. Additional cost (albeit very small) is paid for all WinForms consumers.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That is good information to know for ComWrappers, I will keep this in mind. Thank you for the insight.

@ghost ghost locked as resolved and limited conversation to collaborators Apr 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants