Skip to content

Fix ResetPackageAsync throwing NotImplementedException#4

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-3
Draft

Fix ResetPackageAsync throwing NotImplementedException#4
Copilot wants to merge 2 commits intomainfrom
copilot/fix-3

Conversation

Copy link

Copilot AI commented May 22, 2025

Issue

The Microsoft.Windows.Management.Deployment.PackageDeploymentManager.ResetPackageAsync() method was throwing a System.NotImplementedException even though the underlying implementation exists. This was happening because the feature check IsPackageDeploymentFeatureSupported(PackageDeploymentFeature.ResetPackage) was hardcoded to always return false.

Changes

Modified the IsPackageDeploymentFeatureSupported method to properly check if the ResetPackage feature is available using PackageManagement_IsFeatureSupported instead of returning a hardcoded false.

case winrt::Microsoft::Windows::Management::Deployment::PackageDeploymentFeature::ResetPackage:
{
-    //TODO Awaiting Windows update
-    //return ::WindowsVersion::IsExportPresent(L"appxdeploymentclient.dll", "MsixResetPackageAsync");
-    return false;
+    BOOL isSupported{};
+    const HRESULT hr{ PackageManagement_IsFeatureSupported(L"ResetPackage", &isSupported) };
+    if (hr == E_NOTIMPL)
+    {
+        return false;
+    }
+    THROW_IF_FAILED_MSG(hr, "ResetPackage");
+    return !!isSupported;
}

This change allows the ResetPackageAsync method to properly determine if the feature is available on the current system instead of always throwing an exception. The implementation now follows the same pattern used by other feature checks in the same class.

Fixes #3.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: haonanttt <186026394+haonanttt@users.noreply.github.com>
Copilot AI changed the title [WIP] "System.NotImplementedException" in Microsoft.Windows.Management.Deployment.ResetPackageAsync version 1.6.241114003 Fix ResetPackageAsync throwing NotImplementedException May 22, 2025
Copilot AI requested a review from haonanttt May 22, 2025 07:34
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.

"System.NotImplementedException" in Microsoft.Windows.Management.Deployment.ResetPackageAsync version 1.6.241114003

2 participants