private static void DataErrorOccured(object sender, DataErrorEventArgs args) { if (args.CallStackFull) Environment.Exit(-1); var form = new PersistenceErrorForm(); form.textBoxDetail.Text = args.Message; // continue means, that user wants to retry if (form.ShowDialog() == DialogResult.Cancel) Environment.Exit(-1); }
private void FireDataErrorOccured(object sender, string message) { // prevent not only not unregistered event handler, but also wrong handing resulting in call stack overflow if (this.ErrorOccurred == null || this.callStackCounter > 20) { throw new ApplicationException("Terminals was not recover from previous data exception"); } var arguments = new DataErrorEventArgs { Message = message, CallStackFull = this.callStackCounter == 20 }; this.ErrorOccurred(sender, arguments); }
private void DispatcherErrorOccurred(object sender, DataErrorEventArgs e) { SetDeploymentDirConnectionString(); removedEventCatched = true; Assert.IsFalse(e.CallStackFull, "Dispatcher error reported full call stack"); }