Windows Phone ScheduledTask Agents and FileNotFoundException

Maybe this is a problem that I’m all alone on, but it took me some time to figure out.

I started up a ScheduledAgent for Windows Phone so that I could do some updates with a PeriodicTask, but when I ran the app, I was getting:

FileNotFoundException was unhandled – An unhandled exception of type ‘System.UI.FileNotFoundException’ occurred in System.Windows.ni.dll

Here’s what happened:

I had initially named my ScheduledTask project something stupid, so I needed to re-name it. I did so by clicking on the project name and renaming it.

image

If I had opened the properties section of the project

image

I would have seen that my assembly name (which names the actual file we’re looking for) was still the old stupid name

image

Once I update this name, I need to go to my WMAppManifest.xml file in my startup project and open it with the text editor.

<ExtendedTask Name="BackgroundTask">
  <BackgroundServiceAgent
    Specifier="ScheduledTaskAgent"
    Name="MyAwesomeTask"
    Source="MyScheduledTask"
    Type="MyScheduledTask.ScheduledAgent" />
</ExtendedTask>

It took me some time to figure out what the parameters in the BackgroundServiceAgent meant so:

Specifier – ScheduledTaskAgent

Name – the string name you give your task when you start it. In the example below, it would be Name=MyAwesomeTask:

PeriodicTask myPeriodicTask = new PeriodicTask("MyAwesomeTask");
ScheduledActionService.Add(myPeriodicTask);

Source – the name of the DLL that holds your task code. This is determined in the Assembly name box you see in the properties section of your csproj.

Type – the namespace.type notation that points to the actual object (which must inherit from ScheduledTaskAgent)

3 thoughts on “Windows Phone ScheduledTask Agents and FileNotFoundException

  1. Far more different from the use of photographic films prevalent before,
    digital photography makes use of the technological enhancements that we have today.
    I think we should all send one to our city cousins, to see pictures of
    big calloused hands, farmer tans and sun weathered wrinkled faces that hard working farmers achieve.

    You know, writers may be writing for fiction but
    they are heavily influenced by real life events that shape their work.

Comments are closed.