microsoft / DesktopBridgeToUWP-Samples

This repo contains the samples that demonstrate the usage patterns for the Desktop Conversion extensions.
MIT License
494 stars 271 forks source link

SystrayExtension: System.InvalidOperationException: The process has no package identity #60

Open tjosten opened 6 years ago

tjosten commented 6 years ago

Hi there,

the SystrayExtension-Sample does not seem to work. When deploying the solution and executing it, it successfully launches the WinForms tray icon application. However, when e.g. double clicking the tray icon to open the UWP application, it crashes with an exception:

System.InvalidOperationException: 'The process has no package identity. (Exception from HRESULT: 0x80073D54)'

Can you give me a hint on how to fix this? Haven't found anything useful yet.

wickste commented 6 years ago

Hi Timo,

how did you execute? Launched from the app list entry, or via some other means?

Thanks, Stefan

From: Timo Josten [mailto:notifications@github.com] Sent: Tuesday, March 6, 2018 7:10 AM To: Microsoft/DesktopBridgeToUWP-Samples DesktopBridgeToUWP-Samples@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [Microsoft/DesktopBridgeToUWP-Samples] SystrayExtension: System.InvalidOperationException: The process has no package identity (#60)

Hi there,

the SystrayExtension-Sample does not seem to work. When deploying the solution and executing it, it successfully launches the WinForms tray icon application. However, when e.g. double clicking the tray icon to open the UWP application, it crashes with an exception:

System.InvalidOperationException: 'The process has no package identity. (Exception from HRESULT: 0x80073D54)'

Can you give me a hint on how to fix this? Haven't found anything useful yet.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoft%2FDesktopBridgeToUWP-Samples%2Fissues%2F60&data=04%7C01%7Cswick%40microsoft.com%7C8e64f3c090c04e07a01e08d583745ddd%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636559458179960718%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-2&sdata=wEGD4xg8iQyKaL7UxmS02KHUq1WJwMUGG4QVIsNAyLE%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FASRavKUY8bxa4fA7plzFDwbn5g8glWo6ks5tbqbUgaJpZM4Se36H&data=04%7C01%7Cswick%40microsoft.com%7C8e64f3c090c04e07a01e08d583745ddd%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636559458179960718%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-2&sdata=Lk6b46i538oxaUViK6nTf22Nc5jOGTtADOF1OWRQhDc%3D&reserved=0.

tjosten commented 6 years ago

Hi there, thanks for the fast reply! I have deployed the app and am launching the Executable from the Release-folder. The same happens in my own application when launching the app via Visual Studio.

wickste commented 6 years ago

That’s not a valid way to launch a packaged Windows app. You have to launch it from the app list/start menu in order to run correctly.

From: Timo Josten [mailto:notifications@github.com] Sent: Tuesday, March 6, 2018 7:59 AM To: Microsoft/DesktopBridgeToUWP-Samples DesktopBridgeToUWP-Samples@noreply.github.com Cc: Stefan Wick swick@microsoft.com; Comment comment@noreply.github.com Subject: Re: [Microsoft/DesktopBridgeToUWP-Samples] SystrayExtension: System.InvalidOperationException: The process has no package identity (#60)

Hi there, thanks for the fast reply! I have deployed the app and am launching the Executable from the Release-folder. The same happens in my own application when launching the app via Visual Studio.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoft%2FDesktopBridgeToUWP-Samples%2Fissues%2F60%23issuecomment-370829790&data=04%7C01%7Cswick%40microsoft.com%7C7420c742fb7c4d38e03c08d5837b2056%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636559487208054621%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-2&sdata=%2Bf3j4t3LVpFMAhhpiCivLugQzREcMvGKOTlgh4waWPc%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FASRavLtoILOHksOn1SRXLAfIrNqDj3_sks5tbrIsgaJpZM4Se36H&data=04%7C01%7Cswick%40microsoft.com%7C7420c742fb7c4d38e03c08d5837b2056%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636559487208054621%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-2&sdata=pjadyPhYAClMtR6JD4uExtVDpvUzMY2gW9X5Is0nl5M%3D&reserved=0.

tjosten commented 6 years ago

Could you give me an example of how to do so? I'm sorry for asking but I am very new to Windows development, especially UWP. What would I need to do in order to run the Systray Example App (and use the double-click functionality on the Systray icon to open the UWP app)? Am I even able to deug both of the apps with Visual Studio simultaneously? Thanks very much!

wickste commented 6 years ago
  1. Install the app – either by deploying from VS, or you can also install it from the Store: https://www.microsoft.com/store/productId/9N27GQ9WGRHC
  2. Click on Start to open the Windows start menu
  3. In the app list scroll down to the letter “U” and find “UWP with Systray Extension”
  4. Click on this app list entry
  5. Now the app launches
  6. Close the app and select “Close to Systray”
  7. This will put the icon in the systray and everything should work as expected

Here is some additional information on this sample: https://stefanwick.com/2017/06/24/uwp-app-with-systray-extension/

From: Timo Josten [mailto:notifications@github.com] Sent: Tuesday, March 6, 2018 1:17 PM To: Microsoft/DesktopBridgeToUWP-Samples DesktopBridgeToUWP-Samples@noreply.github.com Cc: Stefan Wick swick@microsoft.com; Comment comment@noreply.github.com Subject: Re: [Microsoft/DesktopBridgeToUWP-Samples] SystrayExtension: System.InvalidOperationException: The process has no package identity (#60)

Could you give me an example of how to do so? I'm sorry for asking but I am very new to Windows development, especially UWP. What would I need to do in order to run the Systray Example App (and use the double-click functionality on the Systray icon to open the UWP app)? Am I even able to deug both of the apps with Visual Studio simultaneously? Thanks very much!

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoft%2FDesktopBridgeToUWP-Samples%2Fissues%2F60%23issuecomment-370931140&data=04%7C01%7Cswick%40microsoft.com%7C0ca9fb541365411e078f08d583a78dad%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636559678021295470%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-2&sdata=pQKHmlJ%2FW4kd8aqW1PuoF7TvMEw4nykVUquoB1fcxWQ%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FASRavGdJqfOwUGeui9v2bE0p-3ek5QlXks5tbvyzgaJpZM4Se36H&data=04%7C01%7Cswick%40microsoft.com%7C0ca9fb541365411e078f08d583a78dad%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636559678021295470%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-2&sdata=0ZBOJZYFv0IFFy0heWx8KJJUtE9LHwieIEse%2BPRd5rU%3D&reserved=0.

tjosten commented 6 years ago

Hi Stefan,

thanks very much, installing the app from the Store did indeed work. One final question for now: Is there any chance to see this use case in action when executing from Visual Studio, e.g. for debugging purposes? I understand that in order to get rid of the exception, the application must be deployed by VS or installed from the Store, which makes it hard to debug, right?

Thanks again for your help.

wickste commented 6 years ago

It works the same way from VS, just make sure you set the UWP project as your startup project, not the Winforms project. Now you can hit F5 to run and the debug the project in the right context.

If you want to debug the Winforms project, launch the UWP without debugging and attach to the Winforms process once it got launched.

Also note that now there is a better way to debug both parts of the solution simultaneously in VS, that wasn’t available at the time when I wrote the sample. Read all about that option at the below link. We should update the sample to use the new mechanism in VS, but didn’t get to it yet.

https://blogs.windows.com/buildingapps/2017/07/06/calling-winrt-components-win32-process-via-desktop-bridge/#V5B4Fsv5pDFUwohR.97

From: Timo Josten notifications@github.com Sent: Wednesday, March 7, 2018 12:06 AM To: Microsoft/DesktopBridgeToUWP-Samples DesktopBridgeToUWP-Samples@noreply.github.com Cc: Stefan Wick swick@microsoft.com; Comment comment@noreply.github.com Subject: Re: [Microsoft/DesktopBridgeToUWP-Samples] SystrayExtension: System.InvalidOperationException: The process has no package identity (#60)

Hi Stefan,

thanks very much, installing the app from the Store did indeed work. One final question for now: Is there any chance to see this use case in action when executing from Visual Studio, e.g. for debugging purposes? I understand that in order to get rid of the exception, the application must be deployed by VS or installed from the Store, which makes it hard to debug, right?

Thanks again for your help.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoft%2FDesktopBridgeToUWP-Samples%2Fissues%2F60%23issuecomment-371056556&data=04%7C01%7Cswick%40microsoft.com%7C026896be20054e32016308d584025317%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636560067877321860%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-2&sdata=gNwxQbTPh3TzETsbSGogovxvYYS0dI0CVUrKXJtOJpg%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FASRavAEi-Hb-z8x0eYWCSNFpz4fVxOgfks5tb5T-gaJpZM4Se36H&data=04%7C01%7Cswick%40microsoft.com%7C026896be20054e32016308d584025317%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636560067877321860%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-2&sdata=F7nMVSpMRLLRyjXfO0N7qdPTb%2F7xKO%2B%2BfWEwvlIM6Jg%3D&reserved=0.