From edfe7a0a9b21bf9efd349408716873023885d170 Mon Sep 17 00:00:00 2001 From: Lauren Ciha Date: Wed, 16 Jul 2025 13:47:09 -0700 Subject: [PATCH] Update PushNotificationManager::PushReceived error code from ERROR_NOT_FOUND to ERROR_INVALID_HANDLE --- dev/PushNotifications/PushNotificationManager.cpp | 2 +- test/PushNotificationTests/BaseTestSuite.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/PushNotifications/PushNotificationManager.cpp b/dev/PushNotifications/PushNotificationManager.cpp index 4cb15e2367..af6049006b 100644 --- a/dev/PushNotifications/PushNotificationManager.cpp +++ b/dev/PushNotifications/PushNotificationManager.cpp @@ -751,7 +751,7 @@ namespace winrt::Microsoft::Windows::PushNotifications::implementation { auto lock{ m_lock.lock_shared() }; - THROW_HR_IF_MSG(HRESULT_FROM_WIN32(ERROR_NOT_FOUND), m_comActivatorRegistration || m_singletonLongRunningSinkRegistration, "Must register event handlers before calling Register()."); + THROW_HR_IF_MSG(HRESULT_FROM_WIN32(ERROR_INVALID_HANDLE), m_comActivatorRegistration || m_singletonLongRunningSinkRegistration, "Must register event handlers before calling Register()."); } auto lock{ m_lock.lock_exclusive() }; diff --git a/test/PushNotificationTests/BaseTestSuite.cpp b/test/PushNotificationTests/BaseTestSuite.cpp index 36c5694e8b..99f86f72f8 100644 --- a/test/PushNotificationTests/BaseTestSuite.cpp +++ b/test/PushNotificationTests/BaseTestSuite.cpp @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation and Contributors. All rights reserved. +// Copyright (c) Microsoft Corporation and Contributors. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. #include "pch.h" @@ -279,7 +279,7 @@ void BaseTestSuite::VerifyForegroundHandlerFails() RegisterWithPushNotificationManager(); if (PushNotificationManager::Default().IsSupported()) { - VERIFY_THROWS_HR(PushNotificationManager::Default().PushReceived([](const auto&, PushNotificationReceivedEventArgs const& /* args */) {}), HRESULT_FROM_WIN32(ERROR_NOT_FOUND)); + VERIFY_THROWS_HR(PushNotificationManager::Default().PushReceived([](const auto&, PushNotificationReceivedEventArgs const& /* args */) {}), HRESULT_FROM_WIN32(ERROR_INVALID_HANDLE); } else {