Port an out-of-process background task to an in-process background task
The simplest way to port your out-of-process (OOP) background activity to in-process activity is to bring your IBackgroundTask.Run method code inside your application, and initiate it from OnBackgroundActivated. The technique being described here is not about creating a shim from an OOP background task to an in-process background task; it's about rewriting (or porting) an OOP version to an in-process version.
If your app has multiple background tasks, the Background Activation Sample shows how you can use
BackgroundActivatedEventArgs.TaskInstance.Task.Name to identify which task is being initiated.
If you are currently communicating between background and foreground processes, you can remove that state management and communication code.
Background tasks and trigger types that cannot be converted