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

Toast notification from c++ app #3861

Closed
ivan2007 opened this issue Mar 18, 2021 · 5 comments · Fixed by #3866
Closed

Toast notification from c++ app #3861

ivan2007 opened this issue Mar 18, 2021 · 5 comments · Fixed by #3866
Assignees
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior Completed 🔥 notifications 🔔
Milestone

Comments

@ivan2007
Copy link

Hi,
I have the following setup
c++ win32 app -> c++/cli netcore 3.1 -> wpf netcore 3.1

I am trying to send a toast notification from the wpf module but I get this exception
image

In my case Assembly.GetEntryAssembly() is always null but the code inside GetDisplayNameFromCurrentProcess doesn't manage it:
private static string GetDisplayNameFromCurrentProcess(Process process) { AssemblyTitleAttribute customAttribute = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyTitleAttribute>(); if (customAttribute != null) return customAttribute.Title; return process.ProcessName; }

@ivan2007 ivan2007 added the bug 🐛 An unexpected issue that highlights incorrect behavior label Mar 18, 2021
@ghost ghost added the needs triage 🔍 label Mar 18, 2021
@ghost
Copy link

ghost commented Mar 18, 2021

Hello ivan2007, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

@michael-hawker
Copy link
Member

FYI @andrewleader

@andrewleader andrewleader self-assigned this Mar 18, 2021
@ghost ghost added the In-PR 🚀 label Mar 18, 2021
@andrewleader
Copy link
Contributor

Hey @ivan2007 thanks for reporting this! Seems like handling the null case will fix it, I opened a super simple PR addressing that: #3866

Are you able to verify by referencing the toolkit locally in that branch to test and verify that this all works as expected in your scenario after that change? Even if you can't thank you regardless for reporting this!!

@ivan2007
Copy link
Author

Hey @andrewleader,
I have recompiled the package with the super simple fix and all works great in my scenario.
Thank you

@ivan2007
Copy link
Author

I have another open issue CommunityToolkit/Microsoft.Toolkit.Win32#306 (comment) but nobody gave me a response. Can you take a look? Thank you

@ghost ghost closed this as completed in #3866 Mar 22, 2021
ghost pushed a commit that referenced this issue Mar 22, 2021
<!-- 🚨 Please Do Not skip any instructions and information mentioned below as they are all required and essential to evaluate and test the PR. By fulfilling all the required information you will be able to reduce the volume of questions and most likely help merge the PR faster 🚨 -->

<!-- 📝 It is preferred if you keep the "☑️ Allow edits by maintainers" checked in the Pull Request Template as it increases collaboration with the Toolkit maintainers by permitting commits to your PR branch (only) created from your fork.  This can let us quickly make fixes for minor typos or forgotten StyleCop issues during review without needing to wait on you doing extra work. Let us help you help us! 🎉 -->


## Fixes #3861
<!-- Add the relevant issue number after the "#" mentioned above (for ex: Fixes #1234) which will automatically close the issue once the PR is merged. -->

<!-- Add a brief overview here of the feature/bug & fix. -->

## PR Type
What kind of change does this PR introduce?
<!-- Please uncomment one or more that apply to this PR. -->

- Bugfix
<!-- - Feature -->
<!-- - Code style update (formatting) -->
<!-- - Refactoring (no functional changes, no api changes) -->
<!-- - Build or CI related changes -->
<!-- - Documentation content changes -->
<!-- - Sample app changes -->
<!-- - Other... Please describe: -->


## What is the current behavior?
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->

If a desktop app's entry assembly is null, sending a notification throws an exception


## What is the new behavior?
<!-- Describe how was this issue resolved or changed? -->

It'll correctly fall back to the process name and work.


## PR Checklist

Customer verified that the fix fixes their problem!

Please check if your PR fulfills the following requirements:

- [x] Tested code with current [supported SDKs](../readme.md#supported)
- [x] Pull Request has been submitted to the documentation repository [instructions](..\contributing.md#docs). Link: <!-- docs PR link -->
- [x] Sample in sample app has been added / updated (for bug fixes / features)
    - [x] Icon has been created (if new sample) following the [Thumbnail Style Guide and templates](https:/windows-toolkit/WindowsCommunityToolkit-design-assets)
- [x] New major technical changes in the toolkit have or will be added to the [Wiki](https:/windows-toolkit/WindowsCommunityToolkit/wiki) e.g. build changes, source generators, testing infrastructure, sample creation changes, etc...
- [x] Tests for the changes have been added (for bug fixes / features) (if applicable)
- [x] Header has been added to all new source files (run *build/UpdateHeaders.bat*)
- [x] Contains **NO** breaking changes

<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. 
     Please note that breaking changes are likely to be rejected within minor release cycles or held until major versions. -->


## Other information
@ghost ghost added Completed 🔥 and removed In-PR 🚀 labels Mar 22, 2021
@ghost ghost locked as resolved and limited conversation to collaborators May 21, 2021
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior Completed 🔥 notifications 🔔
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants