The line of code that throws the error is:
new ToastContentBuilder()
.AddText("Title of notification")
.AddText("Body of notification")
.Show();
The program is a Windows service made in C#, installed using a Wix installer. ToastContentBuilder
comes from the Microsoft.Toolkit.Uwp.Notifications namespace. In Product.wxs
, I have set the ServiceInstall tag as such:
<SeviceInstall Id="ServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="MyProcessName"
DisplayName="My Process Name"
Description="My process description."
Start="auto"
Account="LocalSystem"
ErrorControl="normal"
Arguments=""
Interactive="yes" />
In the Services viewer in Windows, I have checked the properties of the process, and it is logged on as a Local System account, and the "Allow service to interact with desktop" box is checked.
I am aware of a similar question, but that question is unanswered and is seemingly not a service installed using Wix, so it is of little use.
I would appreciate any leads. I am not very familiar with Wix so something in Product.wxs
may be at fault.