I feel like a drongo now.
After more and more repeated testing I have found the cause of my problem.
Old code causing error:
private void tbFilesource_TextChanged(object sender, EventArgs e)
{
if (tbFilesource.Text == "")
{
cbWorkbook.Enabled = false;
}
else
{
cbWorkbook.Enabled = true;
cbWorkbook.Items.Clear();
cbWorkbook.Items.AddRange(
Excelerater.ExcelQueryConiguration.GetWorkbookSpreadsheets(tbFilesource.Text).ToArray());
}
}
This appears to generate the error simply because GetWorkbookSpreadsheets method returns a string[] object which is being converted ToArray() as it is passed to the AddRange method of the combobox.
Updated working code:
private void tbFilesource_TextChanged(object sender, EventArgs e)
{
if (tbFilesource.Text == "")
{
cbWorkbook.Enabled = false;
}
else
{
cbWorkbook.Enabled = true;
cbWorkbook.Items.Clear();
cbWorkbook.Items.AddRange(
Excelerater.ExcelQueryConiguration.GetWorkbookSpreadsheets(tbFilesource.Text));
}
}
As you can see the GetWorkbookSpreadsheets() method is now not being converted ToArray and now does not cause the error.
I figure this is a problem between .net framework versions.
Even though they report the same versions from the static Environment class.