AvalonStudio.Debugging.DebugManager.debugger_Stopped C# (CSharp) Method

debugger_Stopped() private method

private debugger_Stopped ( object sender, StopRecord e ) : void
sender object
e StopRecord
return void
		private async void debugger_Stopped(object sender, StopRecord e)
		{
			if (ignoreEvents)
			{
				return;
			}

			switch (e.Reason)
			{
				case StopReason.ExitedNormally:
				case StopReason.Exited:
				case StopReason.ExitedSignalled:
					IsExecuting = false;
					IsUpdating = false;
					StopDebugSession();
					break;

				default:
					IsUpdating = true;

					if (DebugFrameChanged != null)
					{
						var args = new FrameChangedEventArgs();
						args.Address = e.Frame.Address;
						args.VariableChanges = await currentDebugger.UpdateVariablesAsync();

						DebugFrameChanged(this, args);
					}

                    if (e.Frame != null && e.Frame.File != null)
                    {
                        var normalizedPath = e.Frame.File.Replace("\\\\", "\\").NormalizePath();

                        ISourceFile file = null;

                        var document = _shell.GetDocument(normalizedPath);

                        if (document != null)
                        {
                            lastDocument = document;
                            file = document?.ProjectFile;
                        }
                        
                        if (file == null)
                        {
                            file = _shell.CurrentSolution.FindFile(normalizedPath);
                        }

                        if (file != null)
                        {
                            await
                                Dispatcher.UIThread.InvokeTaskAsync(
                                    async () => { lastDocument = document = await _shell.OpenDocument(file, e.Frame.Line, 1, true); });
                        }
                        else
                        {
                            _console.WriteLine("Unable to find file: " + normalizedPath);
                        }
                    }

                    IsUpdating = false;
                    IsExecuting = false;
                    break;
			}
		}