This project has moved and is read-only. For the latest updates, please go here.

TaskBrowserDialog System.IO.FileNotFoundException

Topics: Errors
Jul 13, 2016 at 6:53 PM
After searching this site I am at a loss for the following issue:
I have downloaded the latest package(s) via Nuget.

Using the TaskBrowserDialog I keep receiving Exception type: System.IO.FileNotFoundException
Message: The system cannot find the file specified.
Is this dialog working in Windows 10?
Anyone have any examples on how to use this UI control?

NOTE: tdbDialogAuto is my TaskBrowserDialog instance.
            using (var ts = new TaskService())
                tbdialogAuto.TaskService = ts;
                tbdialogAuto.SelectedPath = ts.RootFolder.Name;
                tbdialogAuto.AllowFolderSelection = true;
                tbdialogAuto.ShowTasks = true;
Any help is appreciated.
Jul 15, 2016 at 9:40 PM
Just curious, what happens if you do not set the SelectedPath property? Does it still throw the exception? The code I have in the test harness does not include that scenario.
Jul 15, 2016 at 9:42 PM
Also, I add it as a component on my form and set those properties interactively in the designer. To do that, you have to add the assembly to your toolbox though.
Jul 15, 2016 at 11:39 PM
Same error without SelectedPath property, TaskService --in fact I tried the dialog without any settings - just plain dialog from the toolbox..
I did that exact same thing --added it as a component on my form (from toolbox) and set the properties interactively in the designer.
No matter what I try I get the error. Exception type: System.IO.FileNotFoundException

Everything else works awesome though!

Any help much appreciated.
Jul 18, 2016 at 6:42 AM
Edited Jul 18, 2016 at 6:43 AM
Using your exact code snippet, I have successfully run this against the latest version of the library under all .NET builds without error. I even tested it forcing the V1 library without issue. Is the ShowDialog method the one throwing the exception or another line?
Jul 18, 2016 at 7:14 AM
I'll uninstall and reinstall from NuGet.

Maybe I have a corrupt DLL
See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
   at Microsoft.Win32.TaskScheduler.V2Interop.IRegisteredTask.get_Xml()
   at Microsoft.Win32.TaskScheduler.Task.GetV2StrippedDefinition(TaskService svc, IRegisteredTask iTask)
   at Microsoft.Win32.TaskScheduler.Task.CreateTask(TaskService svc, IRegisteredTask iTask, Boolean throwError)
   at Microsoft.Win32.TaskScheduler.TaskCollection.V2TaskEnumerator.<>c__DisplayClass1_0.<.ctor>b__0(Object o)
   at System.Runtime.InteropServices.ComEnumerator`2.get_Current()
   at Microsoft.Win32.TaskScheduler.TaskBrowserDialog.LoadChildren(TreeNode p)
   at Microsoft.Win32.TaskScheduler.TaskBrowserDialog.LoadChildren(TreeNode p)
   at Microsoft.Win32.TaskScheduler.TaskBrowserDialog.RefreshList()
   at Microsoft.Win32.TaskScheduler.TaskBrowserDialog.TaskBrowserDialog_Load(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Jul 18, 2016 at 8:21 AM
Edited Jul 18, 2016 at 8:44 AM
I just uninstalled TaskScheduler from NuGet rebooted, re-compliled, re-installed via NuGet, added the Microsoft.Win32.TaskScheduler.dll to the VS2013 Ultimate (opened as Administrator) toolbox then added the taskBrowserDialog by dragging from the toolbox to the form. Changed the name to tbDialogAuto. Using the exact code above the following error still occurs:

NOTE: I'm on 64bit Dell Precision T7600 Dual (2) 6 core Xeon running Windows 10 Pro

View screenshot here

Another screenshot here
Jul 20, 2016 at 4:12 AM
Looking at the stack dump, it appears you have a task in the root directory that cannot be displayed. This is why you see the error and I don't. I will add some better error handling to this class in the next release.
Marked as answer by dahall on 7/20/2016 at 11:12 AM
Jul 20, 2016 at 11:33 AM
You're 100% spot on sir.
There was a corrupted SqmUpload task related to the Windows Media Player (CEIP) Customer Experience Improvement program. This task gets created by default and a checkbox is automatically checked as a default in the program (under privacy).

I removed that crap from HKLM\Software\Microsoft\WindowsNT\CurrentVersion\Schedule\Taskcache\Tree

Worked perfectly after that.

Thanks for all your help and thanks for giving us an extensible task scheduler!