コード例 #1
0
        public void TestFindSourceFile()
        {
            var attacher = new VSDebugAttacher();
            var file     = attacher.FindSourceFile(typeof(VSIntegrationTest));

            Console.WriteLine(file);
        }
コード例 #2
0
        private void updateErrorArea()
        {
            if (data.ErrorArea == null)
            {
                data.ErrorArea = new Textarea();
            }



            data.ErrorArea.Visible = TW.Debug.LastException != null;
            if (TW.Debug.LastException == null)
            {
                return;
            }
            data.ErrorArea.Text = TW.Debug.LastException.GetType().Name + " - " + TW.Debug.LastException.Message;
            if (!string.IsNullOrEmpty(TW.Debug.LastExceptionExtra))
            {
                data.ErrorArea.Text += "\n" + TW.Debug.LastExceptionExtra;
            }


            //var trace = new StackTrace(TW.Debug.LastException);
            //data.ErrorArea.Text += "\n" + trace.GetFrame(0).GetMethod() + "ello" ;


            data.ErrorArea.Text += "\n" + new string(TW.Debug.LastException.StackTrace.TakeWhile(c => c != '\n').ToArray());

            // Hack to stop serializer from failing!
            data.ErrorArea.Text += "\n";

            Exception inner = TW.Debug.LastException;

            while ((inner = inner.InnerException) != null)
            {
                data.ErrorArea.Text += inner.GetType().Name + " - " + inner.Message;
                //new string(inner.StackTrace.TakeWhile(c => c != '\n').ToArray());
            }

            var wrappedLines = Wrap(data.ErrorArea.Text, 100);

            data.ErrorArea.Text = wrappedLines.Aggregate("", (agg, part) => agg + part + "\n");

            if (TW.Graphics.Keyboard.IsKeyPressed(Key.L))
            {
                var attacher = new VSDebugAttacher();
                attacher.SelectExceptionLine(TW.Debug.LastException);
            }

            var t      = data.ErrorArea;
            var height = wrappedLines.Count * t.FontSize * 2;

            t.Position        = new Vector2(10, 600 - 10 - height);
            t.Size            = new Vector2(800 - 10 * 2, height);
            t.BackgroundColor = new Color4(1, 1, 1, 1);
        }
        public void Simulate()
        {
            if (started)
            {
                return;
            }
            started = true;

            if (Debugger.IsAttached)
            {
                return;
            }


            var a = new VSDebugAttacher();

            a.AttachToVisualStudio();
        }
コード例 #4
0
        public void TestSelectExceptionLine()
        {
            Exception exc;

            try
            {
                throw new NotImplementedException();
            }
            catch (Exception ex)
            {
                exc = ex;
            }



            var attacher = new VSDebugAttacher();

            attacher.SelectExceptionLine(exc);
        }
コード例 #5
0
        public void TestOpenFile()
        {
            var attacher = new VSDebugAttacher();

            attacher.GotoLine(@"C:\_MHData\1 - Projecten\The Wizards\_Source\Gameplay\BugTests.cs", 12);
        }
コード例 #6
0
        public void TestAttach()
        {
            var attacher = new VSDebugAttacher();

            attacher.AttachToVisualStudio();
        }