Skip to content

samples: sync NotesApp with latest ACI API changes#606

Draft
surajkumar-08 wants to merge 9 commits into
microsoft:release/experimentalfrom
surajkumar-08:sync-notesapp-aci-updates
Draft

samples: sync NotesApp with latest ACI API changes#606
surajkumar-08 wants to merge 9 commits into
microsoft:release/experimentalfrom
surajkumar-08:sync-notesapp-aci-updates

Conversation

@surajkumar-08
Copy link
Copy Markdown

@surajkumar-08 surajkumar-08 commented Mar 16, 2026

Summary

Update NotesApp sample to WinAppSDK 2.0.0-preview1 ACI API surface

Namespace & API renames

  • Update namespace from Microsoft.Windows.AI.Search.Experimental.AppContentIndex to Microsoft.Windows.Search.AppContentIndex
  • Rename RemoveRemoveContentItem, RemoveAllRemoveAllContentItems
  • Use RegionOfInterest (on AppManagedImageQueryMatch) instead of Subregion (which remains on AppManagedOcrTextQueryMatch for OCR matches)

New API usage

  • Add pre-flight system capability checks via GetIndexCapabilitiesOfCurrentSystem() before creating an index
  • Subscribe to AppContentIndexListener events (IndexCapabilitiesChanged, IndexStatisticsChanged, ContentItemStatusChanged) for live index monitoring
  • Drive search UI progress bar from IndexStatisticsChanged events
  • Log index statistics via GetIndexStatistics() on startup

Resource management & robustness

  • Dispose AppContentIndexer in MainWindow.Closed handler
  • Add IDisposable to SearchViewModel; call Dispose() via SearchView.Unloaded to release CancellationTokenSource
  • Replace int.Parse with int.TryParse for image match ContentId to avoid FormatException
  • Replace throw new Exception with throw new InvalidOperationException

Cleanup

  • Update WinAppSDK from 2.0.0-experimental3 to 2.0.0-preview1
  • Remove stale commented-out internal project references from csproj
  • Fix README: correct solution filename, update SDK version reference
  • Clean up Package.appxmanifest identity for public sample

Checklist

Note that /azp run currently isn't working for this repo.

surakumar_microsoft and others added 6 commits March 12, 2026 16:24
- Update namespace from Microsoft.Windows.AI.Search.Experimental.AppContentIndex
  to Microsoft.Windows.Search.AppContentIndex
- Rename Remove -> RemoveContentItem, RemoveAll -> RemoveAllContentItems
- Rename Subregion -> RegionOfInterest on image query matches
- Update WinAppSDK from 2.0.0-experimental3 to 2.0.0-preview1
- Add IDisposable to SearchViewModel for proper cleanup
- Remove stale commented-out internal project references from csproj
- Fix README: correct solution filename, update SDK version reference
- Clean up Package.appxmanifest identity for public sample

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Rename SearchViewModel._currentSearchCancellation (was missing '_' prefix,
  inconsistent with _searchText convention)
- Call SearchViewModel.Dispose() via SearchView.Unloaded to release
  CancellationTokenSource when the control is torn down
- Dispose AppContentIndexer in MainWindow.Closed handler so IClosable
  resources are released on window close
- Replace int.Parse with int.TryParse for image match ContentId to avoid
  FormatException on unexpected content IDs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@surajkumar-08
Copy link
Copy Markdown
Author

@abhmondal_microsoft can you please provide your review.

@surajkumar-08
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="Microsoft"

Comment thread Samples/AppContentSearch/cs-winui/Utils/Utils.cs
Comment thread Samples/AppContentSearch/cs-winui/ViewModels/SearchViewModel.cs Outdated
Comment thread Samples/AppContentSearch/cs-winui/Pages/SettingsPage.xaml
Suraj Kumar and others added 2 commits May 21, 2026 10:39
…icrosoft#606

- Utils.cs: Document the reflection-based access of OCR Fragment / Subregion
  properties as a temporary workaround for the preview SDK. Adds TODO comments
  so developers copying this sample know the pattern is not recommended.
- SearchViewModel.cs: Replace the bare _ = RefreshQuerySessionResultsAsync()
  discard with a SafeRefreshQuerySessionResultsAsync helper that observes and
  logs exceptions, so a query session failure can no longer silently stop
  search from working.
- SettingsPage.xaml: Restore accessibility lost when SettingsCard / SettingsExpander
  were replaced with Border / Expander. Add AutomationProperties.Name to the
  card-style Borders and the controls within, and AutomationProperties.HeadingLevel
  to section / sub-section headers so Narrator and other UIA clients can
  navigate the page by landmark and heading.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

3 participants