Silverlight 4 Capture source is not stopped <p>I am working on a Silverlight project to record the audio on a web page.</p> <p>After I clicked the Pause button the code will always throw an exception:</p> <p><strong>Capture source is not stopped</strong></p> <p>If I put a break point on this line of code and wait there for 3-5 seconds then run the code, no exception will be threw.</p> <pre><code> if (audioSink.CaptureSource.State == CaptureState.Started) (break point is on this line) </code></pre> <p>Here is the code</p> <pre><code> private void Pause(object sender, RoutedEventArgs e) { //System.Threading.Thread.Sleep(TimeSpan.FromSeconds(5)); if (audioSink.CaptureSource.State == CaptureState.Started) { audioSink.CaptureSource.Stop(); this.btnPause.IsEnabled = false; this.btnRecord.IsEnabled = true; this.btnSave.IsEnabled = true; } } audioSink.CaptureSource.Stop(); (This is the line of code which throws the exception) </code></pre>