Quantcast
Channel: Task Scheduler Managed Wrapper
Viewing all articles
Browse latest Browse all 2206

Commented Unassigned: Exception when editing a Task [12239]

$
0
0
I'm getting this when editing a Task and trying to change the behaviour if the Task is already running.

System.InvalidCastException was unhandled
HResult=-2147467262
Message=Specified cast is not valid.
Source=Microsoft.Win32.TaskSchedulerEditor
StackTrace:
at Microsoft.Win32.TaskScheduler.TaskPropertiesControl.taskMultInstCombo_SelectedIndexChanged(Object sender, EventArgs e)
at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
at System.Windows.Forms.ComboBox.WmReflectCommand(Message& m)
at System.Windows.Forms.ComboBox.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
InnerException:

I'm calling the UI Dialog as follows:

Microsoft.Win32.TaskScheduler.Task dct = null;

try
{
dct = util.CreateTask();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

if (dct != null)
{
TaskEditDialog ted = new TaskEditDialog(dct, true, true);
try { ted.ShowDialog(); }
catch (Exception ex) { MessageBox.Show(ex.Message); }
}

Windows 10 Professional. Visual Studio 2012. Nuget packages installed Sep 2015. Any assistance gratefully received.
Comments: ** Comment from web user: DonAtVega **

It looks to be this routine...

private void taskMultInstCombo_SelectedIndexChanged(object sender, EventArgs e)
{
if (!onAssignment && v2 && td != null)
td.Settings.MultipleInstances = (TaskInstancesPolicy)((DropDownCheckListItem)taskMultInstCombo.SelectedItem).Value;
}

The td.Settings cast must be wrong somehow....


Viewing all articles
Browse latest Browse all 2206

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>