Beispiel #1
0
        public void FatalityTest()
        {
            var nonfatal1 = new ApplicationException("exception1");
            var nonfatal2 = new InsufficientMemoryException("Oops");
            var fatal1    = new OutOfMemoryException("Oops");
            var fatal2    = new DataException();
            var fatal3    = new AccessViolationException("Oops");
            var fatal4    = new SEHException("Oops");
            var fatal5    = new TypeInitializationException("fulltypename", fatal1);
            var fatal6    = new TargetInvocationException(fatal1);
            var fatal7    = new AggregateException("Oops", new Exception[] { fatal1, fatal2 });
            var fatal8    = new AggregateException("Oops", fatal7);

            Assert.IsFalse(((Exception)null).IsFatal(), "Null should be non fatal");
            Assert.IsFalse(nonfatal1.IsFatal(), "Non fatal 1 expected");
            Assert.IsFalse(nonfatal2.IsFatal(), "Non fatal 2 expected");
            Assert.IsTrue(fatal1.IsFatal(), "Fatal 1 expected");
            Assert.IsTrue(fatal2.IsFatal(), "Fatal 2 expected");
            Assert.IsTrue(fatal3.IsFatal(), "Fatal 3 expected");
            Assert.IsTrue(fatal4.IsFatal(), "Fatal 4 expected");
            Assert.IsTrue(fatal5.IsFatal(), "Fatal 5 expected");
            Assert.IsTrue(fatal6.IsFatal(), "Fatal 6 expected");
            Assert.IsTrue(fatal7.IsFatal(), "Fatal 7 expected");
            Assert.IsTrue(fatal8.IsFatal(), "Fatal 8 expected");
        }
Beispiel #2
0
        public static void ShowOgreException(SEHException sex)
        {
            if (OgreException.IsThrown)
            {
                // already logged
                //LogManager.Singleton.LogMessage("Ogre exception thrown, going to kill game: " + OgreException.LastException.FullDescription + ", Trace: "+ sex.ToString());


                string outputFilename = EngineConfig.CopyLogFileToErrorLogFile();

                string info = "Sorry guys, something went wrong! :/";
                if (OgreException.LastException.Description.Contains("failed to draw primitive") || OgreException.LastException.FullDescription.Contains("failed to draw primitive"))
                {
                    info +=
                        "\r\nThis error is related to your graphics card driver. Try to update drivers. Some of Intel cards (GMA 945) might not be able to handle the game.";
                }


                info += "\r\nError has been logged to: " + outputFilename + "\r\n. Please attach all the files in case of reporting a bug\r\n";
                info += "\r\nOgre exception thrown: " + OgreException.LastException.FullDescription + ", Trace in WOF: " + sex.ToString() + "\r\n";

                ErrorBox errorBox = new ErrorBox(EngineConfig.C_GAME_NAME + " v." + EngineConfig.C_WOF_VERSION + " - Engine error", info);
                errorBox.ShowDialog(FrameWorkForm.ActiveForm);

                /*  MessageBox.Show(OgreException.LastException.FullDescription + info, EngineConfig.C_GAME_NAME + " - Engine error",
                 *               MessageBoxButtons.OK, MessageBoxIcon.Error);*/
            }
        }
Beispiel #3
0
 public static Exception CreateRethrowableClone(SEHException ex)
 {
     if (ex == null)
     {
         throw new ArgumentNullRethrowableException("Can only create a clone of an existing exception.");
     }
     return(new SEHRethrowableException(ex.Message, ex));
 }
        public void TestSEHException()
        {
            var value = new SEHException("Message");

            try
            {
                ExceptionDispatchInfo.Capture(value).Throw();
            }
            catch (SEHException ex)
            {
                Assert.That(ex, Is.Not.SameAs(value));
                Assert.That(ex.ErrorCode, Is.EqualTo(value.ErrorCode));
            }
        }
Beispiel #5
0
        /// <summary>
        /// Get the RPC Exception Code
        /// </summary>
        /// <param name="e">
        /// Exception object</param>
        /// <returns>Returns the RPC error code</returns>
        public static uint RpcExceptionCode(SEHException e)
        {
            uint      errorCode  = 0;
            Type      sehType    = typeof(SEHException);
            FieldInfo xcodeField = sehType.BaseType.BaseType.BaseType.GetField("_xcode", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);

            if (xcodeField != null)
            {
                int code = (int)xcodeField.GetValue(e);
                errorCode = (uint)code;
            }

            return(errorCode);
        }
Beispiel #6
0
        internal static Exception ConvertInPageException(FontSource fontSource, SEHException e)
        {
            string fileName;

            if (fontSource.IsFile)
            {
                fileName = fontSource.Uri.LocalPath;
            }
            else
            {
                fileName = fontSource.GetUriString();
            }

            return(new IOException(SR.Get(SRID.IOExceptionWithFileName, fileName), e));
        }
Beispiel #7
0
        public void SerializationRoundTrip()
        {
            var ex = new SEHException("E_BAD_PIZZA");

            BinaryFormatterHelpers.AssertRoundtrips(ex);
        }
Beispiel #8
0
 public void SerializationRoundTrip()
 {
     var ex = new SEHException("E_BAD_PIZZA");
     BinaryFormatterHelpers.AssertRoundtrips(ex);
 }
Beispiel #9
0
 public WrapperSEHException(string message, SEHException inner)
     : base(message, inner)
 {
     this.HResult = inner.ErrorCode;
 }