Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ManifestHelper.GetClsidFromPackageManifest doesn't work with AppxManifest with more than one application declaration #4993

Open
7 of 14 tasks
ekalchev opened this issue Jun 6, 2024 · 0 comments
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior

Comments

@ekalchev
Copy link

ekalchev commented Jun 6, 2024

Describe the bug

So I am using this code and OnActivated is never raised for my Application package that is packaged as MSIX. The appxmanifest contains multiple application and OnActivated event is raised ONLY if this declaration in appxmanifest is on first Application entry

            <Extensions>
                <com:Extension Category="windows.comServer">
                    <com:ComServer>
                        <com:ExeServer Executable="PdfExtra\WpfApp1.exe" Arguments="-ToastActivated" DisplayName="Toast Activation">
                            <com:Class Id="094A5074-9E99-4E64-BC7A-5131899EFFE7" DisplayName="Toast activation callback" />
                        </com:ExeServer>
                    </com:ComServer>
                </com:Extension>
                <desktop:Extension Category="windows.toastNotificationActivation">
                    <desktop:ToastNotificationActivation ToastActivatorCLSID="094A5074-9E99-4E64-BC7A-5131899EFFE7" />
                </desktop:Extension>
            </Extensions>
protected override void OnStartup(StartupEventArgs e)
 {
            if (ToastNotificationManagerCompat.WasCurrentProcessToastActivated())
            {
                ToastNotificationManagerCompat.OnActivated += ToastNotificationManagerCompat_OnActivated;
            }
            base.OnStartup(e);
}

I started debugging and found this line of code that have hardcoded XPATH that looks for CLSID only in the first application entry in the appxmanifest

internal string GetClsidFromPackageManifest()
{
    var activatorClsidNode = _doc.SelectSingleNode("/default:Package/default:Applications/default:Application[1]/default:Extensions/desktop:Extension[@Category='windows.toastNotificationActivation']/desktop:ToastNotificationActivation/@ToastActivatorCLSID", _namespaceManager);

    if (activatorClsidNode == null)
    {
        throw new InvalidOperationException("Your app manifest must have a toastNotificationActivation extension with a valid ToastActivatorCLSID specified.");
    }

ToastNotificationManagerCompat stop working entirely if multiple apps are declared in your AppxManifest and the COM server is not declared in the first in the application list.

Regression

No response

Reproducible in sample app?

  • This bug can be reproduced in the sample app.

Steps to reproduce

Create Packaged application as MSIX with multiple application in the appxmanifest. Declare com server in any app other than the first one.

Expected behavior

OnActivated should be raised regarding of the order of the app that register the com server

Screenshots

No response

Windows Build Number

  • Windows 10 1809 (Build 17763)
  • Windows 10 1903 (Build 18362)
  • Windows 10 1909 (Build 18363)
  • Windows 10 2004 (Build 19041)
  • Windows 10 20H2 (Build 19042)
  • Windows 10 21H1 (Build 19043)
  • Windows 11 21H2 (Build 22000)
  • Other (specify)

Other Windows Build number

No response

App minimum and target SDK version

  • Windows 10, version 1809 (Build 17763)
  • Windows 10, version 1903 (Build 18362)
  • Windows 10, version 1909 (Build 18363)
  • Windows 10, version 2004 (Build 19041)
  • Other (specify)

Other SDK version

No response

Visual Studio Version

No response

Visual Studio Build Number

No response

Device form factor

No response

Nuget packages

No response

Additional context

No response

Help us help you

No.

@ekalchev ekalchev added the bug 🐛 An unexpected issue that highlights incorrect behavior label Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior
Projects
None yet
Development

No branches or pull requests

1 participant