Visual Studio 2010の構成をデバッグからリリースに変更すると、非常に奇妙な動作が発生します。
私はBackgroundWorker:を持っています_bg、DoWork私は持っています:
iswaiting = true;
_bg.ReportProgress(1, filePath);
while (iswaiting)
{
;
}
//My other part of code (EDIT: something do to with the `result` I get from the user.)
ProgressChanged私はaを持っておりMessageBox、ユーザーとの対話の後、iswaitingfalseに戻され、_bg DoWorkプログラムは続行されます。
void _bg_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
//my other part of code........
result = Microsoft.Windows.Controls.MessageBox.Show("Question" ,"Title", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning);
iswaiting=false;
log(iswaiting.toString());
}
これらはすべて、Visual Studioから実行するか、デバッグモードでビルドすると非常にうまく機能しますが、リリースにビルドすると、ログからはすでにに設定されてwhile(iswaiting)いることがわかりますが、ループから抜け出すことはありません。iswaitingfalse
編集:
これを行うためのより良い方法は大歓迎です!!