Hello,
Welcome to our Microsoft Q&A platform!
Cannot access a disposed object. Object name: 'PrimaryToolbarItem'.
Hi, I tested the code in a Shell project on iOS platform and faced the same issue. The Embedded works fine for the normal image in the contentPage, but it will crash for the ToolbarItem
. You could report this issue to the product team on github for a solution.
If you want to place the images to shared project and load it, you could use ImageSource.FromFile()
instead.
toolbar_item.IconImageSource = ImageSource.FromFile("test.png");
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Hi @JarvanZhang . I am using the exact same code as shown in official Xamarin 101 video tutorial for Embedded Image . And it works fine for displaying all other embedded images (even in IOS). The only place it is not working is Toolbar (and that exception is too). As per your suggestion, I tried using it without this extension method, and it works fine, but I don't want to do that as it will mean I will need to have same Images copied over for all Platforms. Plus as I mentioned it was working absolutely fine, until now.
Hi, OmairAlHamid-6628. I've tested the function with the Embedded image, it works fine on Android. I will test it on iOS and will update here later.