When a UWP app is linked using .NET Native and shipped to the store, toast notifications built using Microsoft.Toolkit.Uwp.Notifications.dll stop working. They still appear, but they lose all context provided by the user and show up as:
$AppName
New Notification
The workaround is to include the notifications assembly in rd.xml, like so:
<Assembly Name="Microsoft.Toolkit.Uwp.Notifications" Dynamic="Required All" />
Yes, because this used to work without unnatural acts. But unclear when that was.
The Toolkit NuGet package should provide an rd.xml that just works, so apps don't have to figure this out themselves.
cf https://devblogs.microsoft.com/dotnet/net-native-deep-dive-making-your-library-great/

Package Version(s): 6.0.0
Windows 10 Build Number:
App min and target version:
Device form factor:
Visual Studio
@andrewleader any thoughts on what may have happened here?
@michael-hawker no idea, and I'm not aware of or familiar with rd.xml and the new .NET Native runtime directives :/
Anything I can do to help with this one?
@mfeingol there are new changes in the PR #3256, but I don't think they'd be related to this, so not sure if it's worth testing this scenario again with those.
_But do you happen to know which version you used before where it last worked?_ Knowing if you have a version of the toolkit and NetCore base NuGet packages that do work would give us a comparison point to see what might have changed since then.
@MattWhilden any advice/thoughts here on what might have changed? I'm assuming we may have upgraded the NetCore package, so is there some config change we need to make on our end?
Unfortunately, I don't, sorry. There was a stretch of maybe 2-3 months before the moment I filed this GHI where the notifications feature wasn't really being used by anyone. I tend to stay current on toolkit updates, so that may provide you with a rough timeline.
Best guess is something in the library started using reflection that wasn't before.
If it helps, btw, I could put together a small repro project for you.
@mfeingol a small repo project would be super valuable, especially if we need to get insight from another team about other parts of the platform, makes it easy to hand-off to them without them needing to understand how to build the full toolkit.
Here you go:
https://github.com/mfeingol/repros/tree/master/NotificationsRepro-3093
Note the difference between the toasts when .NET Native is enabled vs disabled. You can enable .NET Native in project build properties on the debug build, or just compare debug vs. release.
@azchohfi is this something you could take a look at?
I'll look at this now.
I could not repro this with v6.0.0 using UniversalWindowsPlatform 6.2.10. A Release build showed the notification exactly the same as a Debug build.

I tried both x86 as well as x64.
@michael-hawker or @Kyaa-dost , can you test this?
@azchohfi: I'm still seeing a repro here.

Please make sure you're using .NET Native.
I am using .Net Native. That box is marked by default on Release Builds, but I did double check.
I'm not sure how to explain the difference then. It's 100% repro here, release or debug, as long as .NET Native is enabled.
@azchohfi I see the repro on my box (x64, 2004/19041 with VS 2019 16.5.5) when switching from Debug to Release, are you on Insiders?
Debug

Release

I downgraded the Toolkit NuGet to 5.1.1 and saw the same issue though (as well as our latest 6.1 preview bits):

I tried changing the NetCore UWP package, even all the way back to 6.0.1, but saw the same behavior.
@MichalStrehovsky & @TomMcDon any thoughts on what's going on here?