Reputation: 835
I have a UWP app that doesn't seem to build now. What's odd is I have another project that's very similar to it, but it builds just fine. The background task isn't an audio bg task. What is suddenly causing this?
Validation error. error 80080204: App manifest validation error: Line 43, Column 12, Reason: If it is not an audio background task, it is not allowed to have EntryPoint="App.TokenRefreshBackgroundTask" without ActivatableClassId in windows.activatableClass.inProcessServer.
Targeting build 18362.
Upvotes: 3
Views: 2306
Reputation: 1
I also hit this error when I forgot to add the RunTimeComponent project that implemented the IBackgroundTask class as a reference in the UWP project.
Upvotes: -1
Reputation: 51
UPDATE
It turns out this behavior is by design. 'Async' background tasks are not supported by the platform.
--
Old answer, for completeness
It turns out this is a bug in how the AppxManifest is generated during a packaging build. I've filed a bug to address this and will update this thread and the Developer Community ticket once I have an update on its availability.
For now, you can get around this issue by manually specifying the inProcServer entry as a global Extension, like so:
<Extensions>
<Extension Category="windows.activatableClass.inProcessServer">
<InProcessServer>
<Path>CLRHost.dll</Path>
<ActivatableClass ActivatableClassId="App.TokenRefreshBackgroundTask" ThreadingModel="both" />
</InProcessServer>
</Extension>
</Extensions>
Where ActivatableClassId must match the EntryPoint of the backgroundTasks extension.
Note that this is NOT the same 'Extensions' block as the one under the 'Application' node. This one lives at the 'Package' level as a peer of the 'Applications' and 'Capabilities' nodes.
Upvotes: 5
Reputation: 835
The line public void Run(IBackgroundTaskInstance taskInstance)
cannot be async
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.ApplicationModel.Background;
namespace BackgroundTask
{
public sealed class TokenRefreshBackgroundTask : IBackgroundTask
{
public void Run(IBackgroundTaskInstance taskInstance)
{
throw new NotImplementedException();
}
}
}
Upvotes: 2