Skip to content

AppNotificationComboBox Builder Bug Fixes#3393

Closed
loneursid wants to merge 20 commits intomainfrom
user/erlangl/ComboBoxBugs
Closed

AppNotificationComboBox Builder Bug Fixes#3393
loneursid wants to merge 20 commits intomainfrom
user/erlangl/ComboBoxBugs

Conversation

@loneursid
Copy link
Copy Markdown
Contributor

@loneursid loneursid commented Feb 2, 2023

This PR addresses two bugs:

  1. AppNotificationComboBox should respect the developer's wish when ordering its items in xml.
    When generating its xml output, AppNotificationComboBox sorts the items according to their keys (items are key value pairs). The issue with that strategy is that the key names are completely unrelated to the sorting order. AppNotificationComboBox should simply list the items in the order they were added by the developer.

  2. AppNotificationComboBox should immediately report an error when a duplicate item is added
    AppNotificationComboBox items are represented by key value properties. If a developer adds an item with the same key twice, the old item is replaced with the new one and no error is reported. This behavior is almost never what a developer wants. Adding two items with the same key in a combobox is almost always an error on the part of the developer. Instead of silently replacing old item with the new one, AppNotificationComboBox should detect the situation and immediately report the error to the developer.

There are other issues with how properties are managed / validated (or not validated for that matter) but these will be addressed in a separate PR as they also involve other parts of the builder: #3405

@MikeHillberg was invited to the review as we are making a few changes to the API, including deprecating a property.

@loneursid loneursid added the area-Notifications Toast notification, badges, Live Tiles, push notifications label Feb 2, 2023
@loneursid loneursid self-assigned this Feb 2, 2023
@loneursid loneursid changed the title Combobox bugs AppNotificationComboBox Builder Bug Fixes Feb 2, 2023
@loneursid
Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

Comment thread dev/AppNotifications/AppNotificationBuilder/AppNotificationBuilder.idl Outdated
Comment thread dev/AppNotifications/AppNotificationBuilder/AppNotificationBuilder.idl Outdated
Comment thread dev/AppNotifications/AppNotificationBuilder/AppNotificationBuilder.idl Outdated
@loneursid loneursid marked this pull request as ready for review February 3, 2023 04:02
Comment thread dev/AppNotifications/AppNotificationBuilder/AppNotificationComboBox2.h Outdated
};

[contract(AppNotificationBuilderContract, 2)]
runtimeclass AppNotificationComboBox2
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.

Can you follow up with our API reps on this? It will be a point of contention in the API review. Traditionally, we add more contracts and update the versioning in the existing runtime class. See wpnapps idl on how this is accomplished.

Older properties that are not applicable anymore should go through a deprecation ritual. ie. You could say E_NOTIMPL and throw an exception.

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. We're going to go the deprecation road. For now, the caller should see a warning that the old property is being deprecated. if the developer use the old property they will incur a copy as we have to convert data from the old structure to the new one and vice-versa. The good news is that we can't have more than 5 items, so the copy won't have any performance impact.

AppNotificationComboBox(String id);

[deprecated("Use ItemList instead of Items. For more info, see MSDN.", deprecate, AppNotificationBuilderContract, 2)]
Windows.Foundation.Collections.IMap<String, String> Items;
Copy link
Copy Markdown
Contributor Author

@loneursid loneursid Feb 4, 2023

Choose a reason for hiding this comment

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

The Items property has been deprecated and replaced by the itemList property (couldn't think of a better name that wouldn't conflict, but open to suggestions).

In this implementation, AppNotificationComboBox does the conversion between this old property and its internal representation. The alternative would be to throw a "not implemented" error. Throwing is easier but I'm not sure this would be appropriate behavior. @MikeHillberg do you have an opinion on this?

@loneursid
Copy link
Copy Markdown
Contributor Author

/azp run TransportPackage-Foundation-PR

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

@loneursid
Copy link
Copy Markdown
Contributor Author

/azp run TransportPackage-Foundation-PR

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

@loneursid
Copy link
Copy Markdown
Contributor Author

/azp run TransportPackage-Foundation-PR

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

@loneursid
Copy link
Copy Markdown
Contributor Author

/azp run TransportPackage-Foundation-PR

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

@loneursid
Copy link
Copy Markdown
Contributor Author

/azp run TransportPackage-Foundation-PR

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

@loneursid
Copy link
Copy Markdown
Contributor Author

/azp run TransportPackage-Foundation-PR

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

@loneursid
Copy link
Copy Markdown
Contributor Author

/azp run TransportPackage-Foundation-PR

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

@loneursid loneursid added the bug Something isn't working label Mar 4, 2023
@loneursid
Copy link
Copy Markdown
Contributor Author

/azp run TransportPackage-Foundation-PR

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

@loneursid
Copy link
Copy Markdown
Contributor Author

/azp run TransportPackage-Foundation-PR

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

@loneursid
Copy link
Copy Markdown
Contributor Author

/azp run TransportPackage-Foundation-PR

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

@bpulliam bpulliam closed this Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Notifications Toast notification, badges, Live Tiles, push notifications bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants