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

AppNotificationBuilder.BuildNotification fails with ComException when the character ' appears on a AppNotificationButton #4996

Open
marticliment opened this issue Dec 21, 2024 · 0 comments

Comments

@marticliment
Copy link

Describe the bug

When trying to create a AppNotificationBuilder, buttons can't contain the ' character, or otherwhise when calling the builder.BuildNotification method the following COMException will be thrown:

System.Runtime.InteropServices.COMException (0xC00CE509): Required white space was missing.
at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|38_0(Int32 hr)
at ABI.Microsoft.Windows.AppNotifications.Builder.IAppNotificationBuilderMethods.BuildNotification(IObjectReference _obj)
at Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilder.BuildNotification()
at C:\My\Path\MyFile.cs:line 128

Steps to reproduce the bug

IMPORTANT: This bug is only reproducable when the solution is built as "Release", as "Debug" builds will work without further issues

The following code causes the issue:

// This line will always work
AppNotificationBuilder builder = new AppNotificationBuilder()
    .SetScenario(AppNotificationScenario.Default)
    .SetTag("UpdatesNotifications")

    .AddText("Adding a ' here is fine. They work as expected and don't crash")
    .AddText("More text")
    .SetAttributionText("Some attribution")

    .AddButton(new AppNotificationButton("Adding a ' here causes the COMException"))
        .AddArgument("action", "action1")
    )
    .AddButton(new AppNotificationButton("Another button")
        .AddArgument("action", "action2")
    )
    .AddArgument("action", "action3");

// The COMException occurrs on the line below
AppNotification notification = builder.BuildNotification();

Expected behavior

Notifications to support ' characters on buttons.

Screenshots

N/A

NuGet package version

Windows App SDK 1.6.3: 1.6.241114003

Packaging type

Unpackaged

Windows version

Windows 11 version 22H2 (22621, 2022 Update)

IDE

Other

Additional context

I have tried escaping the ' character by \\' with no luck,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant