Exemple #1
0
        //====================================================================================================================//

        public static void DoErrorHandling(Exception ex, string errorDetails, bool canIgnore = false)
        {
#if DEBUG
            var result = SharpDX.Result.GetResultFromException(ex);

            string Errors = "Directx: " + result.Code + " - " + ex.Message + "\n\n" + ex.StackTrace;

            if (s_infoQueue != null)
            {
                for (int j = 0; j < s_infoQueue.NumStoredMessages; j++)
                {
                    D3D11.Message a = s_infoQueue.GetMessage(j);

                    Errors = a.Description.ToString().Trim('\0') + '\n' + Errors;

                    Console.WriteLine(a.Description.ToString());
                }

                Console.WriteLine(Errors);
            }

#if !WINDOWS_UWP
            Strafe.PopupErrorBox.Show("Object Type: " + ex.TargetSite.DeclaringType.FullName, "Stack Trace: " + ex.StackTrace, "Error Message:" + ex.Message + '\n' + Errors);

            if (!canIgnore)
            {
                Application.Exit();
            }
#endif
#endif
        }
Exemple #2
0
        /// <summary>	
        /// No documentation.	
        /// </summary>	
        /// <param name="messageIndex">No documentation.</param>	
        /// <returns>No documentation.</returns>	
        /// <include file='.\..\Documentation\CodeComments.xml' path="/comments/comment[@id='ID3D11InfoQueue::GetMessageW']/*"/>	
        /// <unmanaged>HRESULT ID3D11InfoQueue::GetMessageW([In] unsigned longlong MessageIndex,[Out, Buffer, Optional] D3D11_MESSAGE* pMessage,[InOut] SIZE_T* pMessageByteLength)</unmanaged>	
        public unsafe Message GetMessage(long messageIndex)
        {
            PointerSize messageSize = 0;
            GetMessage(messageIndex, IntPtr.Zero, ref messageSize);

            var messagePtr = stackalloc byte[(int)messageSize];
            GetMessage(messageIndex, new IntPtr(messagePtr), ref messageSize);

            var message = new Message();
            message.__MarshalFrom(ref *(Message.__Native*)messagePtr);
            return message;
        }