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.
If I had opened the properties section of the project
I would have seen that my assembly name (which names the actual file we’re looking for) was still the old stupid name
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 Responses to Windows Phone ScheduledTask Agents and FileNotFoundException
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.
Pingback: Windows Phone ScheduledTask Agents and FileNotFoundException | Matthias Shapiro | Hispafoxing
Pingback: Dew Drop – January 14, 2013 (#1,479) | Alvin Ashcraft's Morning Dew