You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 25, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 25, 2026. It is now read-only.
TileContentBuilder - exception adding text on Wide tile #3955
When creating Live tile content via TileContentBuilder, I always get NullReferenceException when setting the text on Wide sized tile.
❗ This only happens when trying to create Wide Live tile alone ❗ When Medium tile is present, it's all working.
Is this bug a regression in the toolkit?
No, it's a bug on the current version as well as in the current repository code.
Steps to Reproduce
Can this be reproduced in the Sample App?
No, because in the sample app you're creating Live tile content for all sizes: Medium, Wide, and Large, this only happens when you want to set solely Wide Live tile content.
Create sample Live tile content with TileContentBuilder, but only for Wide tile size, like in the sample code below and try to run it:
var builder = new TileContentBuilder();
builder.AddTile(TileSize.Wide)
.SetTextStacking(TileTextStacking.Top)
.AddText("Header", hintStyle: AdaptiveTextStyle.Base)
.AddText("Subtitle", hintStyle: AdaptiveTextStyle.CaptionSubtle)
.SetBranding(TileBranding.NameAndLogo);
TileUpdateManager.CreateTileUpdaterForApplication().Update(new TileNotification(builder.Content.GetXml()));
Expected behavior
Screenshots
Bug in code
According to NullReferenceException, the core issue was thrown from this method: TileContentBuilder.AddAdaptiveTileVisualChild(ITileBindingContentAdaptiveChild child, TileSize size)
After inspecting the code of that method in this repository, I think I found what's causing it.
It's this line in the method, it's incorrectly getting the content from MediumTile instead of WideTile. As MediumTile is not set in my case, the exception is thrown.
Any chance you're also interested in fixing it? 😊 If you don't have the time or ability, no worries, but figured I'd ask first as it seems like you've already poked around in the code some and I'm not sure I'll be able to get to this super soon. Let me know if you're interested in trying to fix it!
That's it! Thanks @supermartzin!! 😊 Let me know if you have any questions! There are also some unit tests inside UnitTests.Notifications.Shared, it'd be nice if you add a unit test alongside the fix to cover this case (clearly we were missing one previously for this case).
Thanks @supermartzin 🎉, we have more info on anything you should need to get contributing to the project in our wiki. Let us know if you need any help, main thing is usually just to create a feature branch in your fork.
Activity
michael-hawker commentedon Apr 21, 2021
FYI @andrewleader
andrewleader commentedon Apr 21, 2021
Thanks for reporting this @supermartzin!
Any chance you're also interested in fixing it? 😊 If you don't have the time or ability, no worries, but figured I'd ask first as it seems like you've already poked around in the code some and I'm not sure I'll be able to get to this super soon. Let me know if you're interested in trying to fix it!
supermartzin commentedon Apr 22, 2021
Hi @andrewleader, no problem!
Just fork the repo, fix the problem, and create PR? Or any other steps to follow? 🙂
Thanks!
andrewleader commentedon Apr 22, 2021
That's it! Thanks @supermartzin!! 😊 Let me know if you have any questions! There are also some unit tests inside UnitTests.Notifications.Shared, it'd be nice if you add a unit test alongside the fix to cover this case (clearly we were missing one previously for this case).
michael-hawker commentedon Apr 22, 2021
Thanks @supermartzin 🎉, we have more info on anything you should need to get contributing to the project in our wiki. Let us know if you need any help, main thing is usually just to create a feature branch in your fork.
Fixes CommunityToolkit#3955 - Fixed NRE when setting text on Wide til…
Fixed NRE when setting text on Wide tile only via TileContentBuilder (#…