Ok here's the pretty light code:
//
// numConfigsBindingSource
//
this.numConfigsBindingSource.DataMember = "NumConfigs";
this.numConfigsBindingSource.DataSource = this.DSNumConfigs;
// Grid
this.GridNumConfigs.DataSource = this.numConfigsBindingSource;
//
// DSNumConfigs
//
this.DSNumConfigs.DataSetName = "DSNumConfigs";
this.DSNumConfigs.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
//
// numConfigsTableAdapter
//
this.numConfigsTableAdapter.ClearBeforeFill = false;
//
//
// DSConfigNumbers
//
this.DSConfigNumbers.DataSetName = "DSConfigNumbers";
this.DSConfigNumbers.EnforceConstraints = false;
this.DSConfigNumbers.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
private void Form1_Load(object sender, EventArgs e)
{
worker.RunWorkerAsync();
}
private void worker_DoWork(object sender, DoWorkEventArgs e)
{
this.numConfigsTableAdapter.Fill(this.DSNumConfigs.NumConfigs);
}
Then I run this code under VS2010 it works find but when I just run release application it's hanging. But if I rewrite this code that isn't using BackgroundWorkers
it's works fine.
Do I need some effort to clearly release background worker? I have tried to lock worker class in Form1_Load
it isn't provide any success. Also have tried to lock this.DSNumConfigs
in DoWork
and also no any successful stuff.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…