Недопустимый параметр в Images
господа не могу ни как решить проблему с ошибкой чтения из imageList1.Images, после 20-25 примерно минут работы программы и множеств сотен однотипных чтений из imageList1 на очередном периоде она стабильно крашится, причем ни какие обработчики ошибок не спасаю ибо при повторном чтении ошибка не уходит, да и на панели задач происходит задвоение ярлыка программы и панель превращается в кашу из ярлыков разных программ. Проверялась на .NET Framework 4.5/Win 8.1 и Win10.
this.Invoke(new Action(() => dataGridView5.Rows[i].Cells[8].Value = imageList1.Images[28]));
System.ArgumentException HResult=0x80070057 Message=Недопустимый параметр. Source=System.Drawing StackTrace: at System.Drawing.Graphics.GetHdc() at System.Windows.Forms.ImageList.GetBitmap(Int32 index) at System.Windows.Forms.ImageList.ImageCollection.get_Item(Int32 index)
at ASAM_Administrator.MainForm.<>c__DisplayClass609_10.b__44() in C:\Users\Сергей\Desktop\Projects Visual Studio\ProjectsAdministrator\ProjectsAdministrator\MainForm.cs:line 122
Вот где встречается imageList1
_PathDetailDesc = Component.imageList1.Images[2];
_PathDetailDesc = Component.imageList1.Images[3];
_Status = Component.imageList1.Images[3];
notifyIcon1.Icon = Icon.FromHandle(((Bitmap)imageList1.Images[31]).GetHicon());
beginSend.SendMessageChatImage(richTextBox1.Text, dataGridView2, dataGridView7, imageList1, imageList2, imageList8, 0, null);
this.Invoke(new Action(() => dataGridView2.Rows.Add(imageList1.Images[45], "0", imageList1.Images[2], "0", "0", imageList2.Images[48])));
this.Invoke(new Action(() => dataGridView2.Rows.Add(imageList1.Images[45], "0", imageList1.Images[2], "0", "0", imageList2.Images[48])));
this.Invoke(new Action(() => dataGridView2.Rows[i].Cells[0].Value = imageList1.Images[45]));
this.Invoke(new Action(() => dataGridView2.Rows[i].Cells[2].Value = imageList1.Images[78]));
this.Invoke(new Action(() => dataGridView2.Rows[i].Cells[2].Value = imageList1.Images[3]));
this.Invoke(new Action(() => dataGridView2.Rows.Add(imageList1.Images[45], "0", imageList1.Images[2], "0", "0", imageList2.Images[48])));
this.Invoke(new Action(() => dataGridView2.Rows.Add(imageList1.Images[45], "0", imageList1.Images[2], "0", "0", imageList2.Images[48])));
this.Invoke(new Action(() => dataGridView2.Rows[numberRows].Cells[0].Value = imageList1.Images[45]));
this.Invoke(new Action(() => dataGridView2.Rows[numberRows].Cells[2].Value = imageList1.Images[78]));
this.Invoke(new Action(() => dataGridView2.Rows[numberRows].Cells[2].Value = imageList1.Images[3]));
this.Invoke(new Action(() => dataGridView2.Rows.Add(imageList1.Images[45], _StringData.RemoteUserName, imageList1.Images[3], _StringData.LocalSID, _StringData.RemoteSID, ImageUser)));
this.Invoke(new Action(() => dataGridView2.Rows.Add(imageList1.Images[45], _StringData.RemoteUserName, imageList1.Images[3], _StringData.LocalSID, _StringData.RemoteSID, ImageUser)));
this.Invoke(new Action(() => dataGridView2.Rows[i].Cells[0].Value = imageList1.Images[45]));
this.Invoke(new Action(() => dataGridView2.Rows[i].Cells[2].Value = imageList1.Images[3]));
this.Invoke(new Action(() => dataGridView2.Rows.Add(imageList1.Images[45], "0", imageList1.Images[2], "0", "0", imageList2.Images[48])));
this.Invoke(new Action(() => dataGridView2.Rows.Add(imageList1.Images[45], "0", imageList1.Images[2], "0", "0", imageList2.Images[48])));
this.Invoke(new Action(() => dataGridView2.Rows[numberRows].Cells[0].Value = imageList1.Images[45]));
this.Invoke(new Action(() => dataGridView2.Rows[numberRows].Cells[2].Value = imageList1.Images[78]));
this.Invoke(new Action(() => dataGridView2.Rows[numberRows].Cells[2].Value = imageList1.Images[3]));
ValueSendMessages.WaitingIncoming = new Thread(() => _newChat.WaitingIncoming(imageList1, imageList2, imageList8, dataGridView2, dataGridView7, richTextBox5, tabControl2, button143,panel10));
ValueSendMessages.MDSC[0].ListUsers[indexRow].ThreadSending = new Thread(() => _initializationSend.CheckingSendValues(dataGridView7, imageList1, imageList2, imageList8, dataGridView2.Rows[GetSelect.Index].Cells[4].Value.ToString(), indexRow));
beginSend.SendMessageChatRtf(richTextBox1.Rtf, tabControl2, dataGridView2, richTextBox1, imageList1, imageList2, imageList8);
beginSend.SendMessageChat(richTextBox1.Text, tabControl2, dataGridView2, dataGridView7, imageList1, imageList2, imageList8);
imageList1.Images[45],
imageList1.Images[3],
SendMessages.BasicMethods.OpenContactTab(dataGridView2,imageList1,tabControl2,e);
beginSend.SendMessageChatImage(richTextBox1.Text, dataGridView2, dataGridView7, imageList1, imageList2, imageList8, 0, _fileInfo);
imageList1, imageList2, imageList8, panel10, panel11, panel12, button177, trackBar1, _fileInfo,tabControl2));
imageList1, imageList2, imageList8, panel10, panel11, panel12, button177, trackBar1, tabControl2));
dataGridView2.Rows[GetSelect.Cells[3].RowIndex].Cells[0].Value = imageList1.Images[46];
dataGridView2.Rows[GetSelect.Cells[3].RowIndex].Cells[0].Value = imageList1.Images[46];
dataGridView2.Rows[GetSelect.Cells[3].RowIndex].Cells[0].Value = imageList1.Images[45];
imageCell.Value = imageList1.Images[78];
imageCell.Value = imageList1.Images[3];
dataGridView3.Rows[ValueSoftwareForPC.SelectedRows].Cells[4].Value = imageList1.Images[23];
Rows[ValueSoftwareForPC.SelectedRows].Cells[4].Value = imageList1.Images[23];
this.Invoke(new Action(() => dataGridView3.Rows[ValueSoftwareForPC.SelectedRows].Cells[4].Value = imageList1.Images[3]));
DataGridViewForTab.Rows[ValueSoftwareForPC.SelectedRows].Cells[4].Value = imageList1.Images[3]));
ExecImage = imageList1.Images[2];
ExecImage = imageList1.Images[3];
ExecImage = imageList1.Images[2];
ExecImage = imageList1.Images[3];
DocImage = imageList1.Images[2];
DocImage = imageList1.Images[3];
RunImage = imageList1.Images[3];
ExecImage = imageList1.Images[2];
ExecImage = imageList1.Images[3];
ExecImage = imageList1.Images[2];
ExecImage = imageList1.Images[3];
DocImage = imageList1.Images[2];
DocImage = imageList1.Images[3];
RunImage = imageList1.Images[3];
this.Invoke(new Action(() => dataGridView3.Rows[i].Cells[4].Value = imageList1.Images[23]));
this.Invoke(new Action(() => dataGridView3.Rows[i].Cells[4].Value = imageList1.Images[3]));
this.Invoke(new Action(() => ValueSoftwareForPC.ListDataTabControl[_iNdex].DataGridViewForTab.Rows[i].Cells[4].Value = imageList1.Images[23]));
this.Invoke(new Action(() => ValueSoftwareForPC.ListDataTabControl[_iNdex].DataGridViewForTab.Rows[i].Cells[4].Value = imageList1.Images[23]));
this.Invoke(new Action(() => ValueSoftwareForPC.ListDataTabControl[_iNdex].DataGridViewForTab.Rows[i].Cells[4].Value = imageList1.Images[23]));
this.Invoke(new Action(() => ValueSoftwareForPC.ListDataTabControl[_iNdex].DataGridViewForTab.Rows[i].Cells[4].Value = imageList1.Images[3]));
contextMenuStrip6.Items.Add(_Items.NameServer + "/" + _Items.NameUser, imageList1.Images[21]);
ValueDiskInfo.ListDataTabControl[0].ListDisk[i].FileSystem, "", imageList1.Images[2])));
this.Invoke(new Action(() => dataGridView5.Rows[i].Cells[9].Value = imageList1.Images[3]));
else this.Invoke(new Action(() => dataGridView5.Rows[i].Cells[9].Value = imageList1.Images[2]));
this.Invoke(new Action(() => dataGridView5.Rows[i].Cells[8].Value = imageList1.Images[28]));
this.Invoke(new Action(() => dataGridView5.Rows[i].Cells[9].Value = imageList1.Images[28]));
ValueDiskInfo.ListDataTabControl[_iNdex].ListDisk[i].FileSystem, "", imageList1.Images[2])));
this.Invoke(new Action(() => ValueDiskInfo.ListDataTabControl[_iNdex].DataGridViewForTab.Rows[i].Cells[9].Value = imageList1.Images[3].Clone()));
this.Invoke(new Action(() => ValueDiskInfo.ListDataTabControl[_iNdex].DataGridViewForTab.Rows[i].Cells[9].Value = imageList1.Images[78].Clone()));
this.Invoke(new Action(() => ValueDiskInfo.ListDataTabControl[_iNdex].DataGridViewForTab.Rows[i].Cells[9].Value = imageList1.Images[28].Clone()));
this.Invoke(new Action(() => ValueDiskInfo.ListDataTabControl[_iNdex].DataGridViewForTab.Rows[i].Cells[9].Value = imageList1.Images[28].Clone()));
Thread StartFormat = new Thread(() => InitialFormat.FormatingDevice(ValueDiskInfo.SelectedLabel,dataGridView5, ValueDiskInfo.SelectedRows, imageList1, ValueDiskInfo.SelectedRows));
this.button152.ImageList = this.imageList1;
this.button175.ImageList = this.imageList1;
this.button6.ImageList = this.imageList1;
this.button23.ImageList = this.imageList1;
this.button122.ImageList = this.imageList1;
this.button28.ImageList = this.imageList1;
this.button123.ImageList = this.imageList1;
this.button145.ImageList = this.imageList1;
this.treeView1.ImageList = this.imageList1;
this.treeView3.ImageList = this.imageList1;
this.button51.ImageList = this.imageList1;
this.button179.ImageList = this.imageList1;
this.button79.ImageList = this.imageList1;
this.button9.ImageList = this.imageList1;
this.button83.ImageList = this.imageList1;
this.button82.ImageList = this.imageList1;
this.button81.ImageList = this.imageList1;
this.button118.ImageList = this.imageList1;
this.button80.ImageList = this.imageList1;
this.button78.ImageList = this.imageList1;
this.button77.ImageList = this.imageList1;
this.button22.ImageList = this.imageList1;
this.button21.ImageList = this.imageList1;
this.button127.ImageList = this.imageList1;
this.button126.ImageList = this.imageList1;
this.button125.ImageList = this.imageList1;
this.button124.ImageList = this.imageList1;
this.button74.ImageList = this.imageList1;
this.button75.ImageList = this.imageList1;
this.button76.ImageList = this.imageList1;
this.button115.ImageList = this.imageList1;
this.button88.ImageList = this.imageList1;
this.button87.ImageList = this.imageList1;
this.button63.ImageList = this.imageList1;
this.button60.ImageList = this.imageList1;
_PathExecutionFile = Component.imageList1.Images[3];
_PathExecutionFile = Component.imageList1.Images[2];