Example #1
0
        private void OnObjectFinished(MessageData dataContainer)
        {
            var dataBytes = dataContainer.IsDataCompressed
                                ? ZlibStream.UncompressBuffer(dataContainer.Data) : dataContainer.Data;

            using (var dataStream = new MemoryStream(dataBytes))
                using (var dataReader = new BinaryReader(dataStream))
                {
                    object receivedMessage;
                    try
                    {
                        receivedMessage = TryReceiveMessage(dataReader);
                    }
                    catch (Exception ex)
                    {
                        receivedMessage =
                            new ServerError(StackTraceExtensions.FormatExceptionIntoClickableMultilineText(ex));
                    }
                    if (DataReceived != null)
                    {
                        DataReceived(receivedMessage);
                    }
                    else
                    {
                        throw new NobodyIsUsingTheDataReceivedEvent(receivedMessage);
                    }
                }
        }
Example #2
0
        //ncrunch: no coverage start
        private void ShowInitializationErrorBox(Type baseType, Exception ex)
        {
            var exceptionText = StackTraceExtensions.FormatExceptionIntoClickableMultilineText(ex);
            var window        = Resolve <Window>();

            window.CopyTextToClipboard(exceptionText);
            const string Header = "Fatal Initialization Error";
            var          text   = GetHintTextForKnownIssues(ex);

            text += "Unable to resolve class " + baseType + "\n";
            if (ExceptionExtensions.IsDebugMode)
            {
                text += exceptionText;
            }
            else
            {
                text += ex.GetType().Name + " " + ex.Message;
            }
            text += ErrorWasCopiedToClipboardMessage + ClickIgnoreToContinue;
            if (window.ShowMessageBox(Header, text, new[] { "Ignore", "Abort" }) != "Abort")
            {
                return;
            }
            Dispose();
            if (!StackTraceExtensions.StartedFromNCrunchOrNunitConsole)
            {
                Environment.Exit((int)AppRunner.ExitCode.InitializationError);
            }
        }
Example #3
0
 public void FormatExceptionIntoClickableMultilineText()
 {
     try
     {
         TryFormatExceptionIntoClickableMultilineText();
     }             // ncrunch: no coverage
     catch (Exception ex)
     {
         Console.WriteLine(StackTraceExtensions.FormatExceptionIntoClickableMultilineText(ex));
     }
 }