AccessViolation on closing TaskEditor Window

26 views
Skip to first unread message

as....@gmx.de

unread,
Jan 22, 2019, 3:45:15 AM1/22/19
to Task Scheduler Managed Wrapper
Hi there,
I'm using the editor.ShowDialog() in my small Application.
Doing so I get quite often but not always an AccessViolation, when I try to close the Dialog window - either pressing Cancel or OK.
(details see below)

Do you have any hint?

I used example code from the project page.

 using (var service= new TaskService())
            {
                var task = service.GetTask(taskname);
                if (task == null)
                {

                    //_log.Info("ScheduledTask: Create new Task");
                    // Create a new task definition and assign properties
                    var td = service.NewTask();
                    td.RegistrationInfo.Description = taskname;

                    // Create a trigger that will fire the task at this time every other day
                    td.Triggers.Add(new WeeklyTrigger {StartBoundary = DateTime.Today});

                    // Create an action that will launch Notepad whenever the trigger fires
                    var runner = AppDomain.CurrentDomain.BaseDirectory + "\\Runner.exe";
                    td.Actions.Add(new ExecAction(runner, " \"" + backupConfigFilepath + "\" "));
                    service.RootFolder.RegisterTaskDefinition(taskname, td);
                }

                TaskEditDialog editorForm = new TaskEditDialog();
                editorForm.Editable = true;
                editorForm.RegisterTaskOnAccept = true;
                editorForm.Initialize(task);
                // ** The four lines above can be replaced by using the full constructor
                // TaskEditDialog editorForm = new TaskEditDialog(t, true, true);
                editorForm.ShowDialog();
            }



NameValueType
$exception{"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."}System.AccessViolationException

▶ Data{System.Collections.ListDictionaryInternal}System.Collections.IDictionary {System.Collections.ListDictionaryInternal}

HResult-2147467261int

HelpLinknullstring

▶ InnerExceptionnullSystem.Exception

Message"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."string

Source"System.Windows.Forms"string

StackTrace" at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)\r\n at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)\r\n at System.Windows.Forms.Control.WndProc(Message& m)\r\n at System.Windows.Forms.ComboBox.WndProc(Message& m)\r\n at System.Windows.Forms.DisabledItemComboBox.WndProc(Message& m)\r\n at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, Int32 wParam, Int32 lParam)\r\n at System.Windows.Forms.ComboBox.get_SelectedIndex()\r\n at System.Windows.Forms.ComboBox.OnHandleDestroyed(EventArgs e)\r\n at System.Windows.Forms.Control.WmDestroy(Message& m)\r\n at System.Windows.Forms.Control.WndProc(Message& m)\r\n at System.Windows.Forms.ComboBox.WndProc(Message& m)\r\n at System.Windows.Forms.DisabledItemComboBox.WndProc(Message& m)\r\n at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)"string

▶ TargetSite{IntPtr CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr)}System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}
 

as....@gmx.de

unread,
Jan 25, 2019, 2:57:19 AM1/25/19
to Task Scheduler Managed Wrapper
It's me again.
To clarifiy, I reduced my Application to basics: MainWindow, one button, which opens the TaskSchedulerEditor. (Code below).
It's the same effect, I get very frequently an accessViolation and the whole application crashes. Seems, that there is something wrong in the dll.

<Window x:Class="WpfApp1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp1"
        mc:Ignorable="d"
        Title="MainWindow" Height="300" Width="500">
    <Grid>
        <Button Content="Button" HorizontalAlignment="Left" Margin="200,100,0,0" VerticalAlignment="Top" Width="75" Click="Button_OnClick" />
    </Grid>
</Window>

using System.Windows;
using Microsoft.Win32.TaskScheduler;

namespace WpfApp1
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Button_OnClick(object sender, RoutedEventArgs e)
        {
            using (var service = new TaskService())
            {
                var task = service.GetTask("GxPDatabaseBackupTask");
                task.ShowEditor();
            }
        }
    }
}


daha...@gmail.com

unread,
Jul 17, 2019, 12:00:22 PM7/17/19
to Task Scheduler Managed Wrapper
Please try again with the current version of the library (2.8.13). I made some corrections to the UI to prevent a number of disposal race conditions. Please let me know your results.
Reply all
Reply to author
Forward
0 new messages