Click here to Skip to main content
15,886,422 members
Articles / Programming Languages / C#

Coded UI tests: Visual Studio Crashed While Moving Code from UIMap.Designer.cs to UIMap.cs from Coded UI Test Editor

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
10 Dec 2012CPOL 8.4K   1  
Visual Studio crashed while moving code from UIMap.Designer.cs to UIMap.cs from Coded UI Test Editor

Few days ago, I encountered an error. When I try to move a recorded function from UIMap.designer.cs to UIMap.cs, Visual Studio crashed.

I was unable to find why it stopped working correctly. After searching on forums, etc. I still get no clue.

Then, I begin to inspect my code files and loaded a previous version of my solution and compared it to my current version. After few hours, I was able to find the root cause.

The code written in the UIMAP.cs file should be in a specific order. The code should start like this:

C#
*******************************************************************************
 namespace Saad.Maps.DMap
{
    using Microsoft.VisualStudio.TestTools.UITesting.WinControls;
    using System;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Windows.Input;
    using System.CodeDom.Compiler;
    using System.Text.RegularExpressions;
    using Microsoft.VisualStudio.TestTools.UITest.Extension;
    using Microsoft.VisualStudio.TestTools.UITesting;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard;
    using Mouse = Microsoft.VisualStudio.TestTools.UITesting.Mouse;
    using MouseButtons = System.Windows.Forms.MouseButtons;
    
    public partial class UIMap
    {

**********************************************************************

and my file was like that….

C#
**********************************************************************
    using Microsoft.VisualStudio.TestTools.UITesting.WinControls;

    using System;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Windows.Input;
    using System.CodeDom.Compiler;
    using System.Text.RegularExpressions;
    using Microsoft.VisualStudio.TestTools.UITest.Extension;
    using Microsoft.VisualStudio.TestTools.UITesting;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard;
    using Mouse = Microsoft.VisualStudio.TestTools.UITesting.Mouse;
    using MouseButtons = System.Windows.Forms.MouseButtons;
     
namespace Saad.Maps.DMap
{
    public partial class UIMap
    {

***********************************************************************

Yeah, can you note the difference.

The using clause should come under namespace clause. If it is not the case, then coded ui test editor will not be able to move code in that UIMAP.cs file. If you correct the code sequence in the UIMAP.cs file and write using clause under namespace clause, then you will be able to move code successfully.

I hope it will help somebody and this post should help Microsoft to remove that bug too.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Tester / Quality Assurance
Pakistan Pakistan
Working as a Testing Automation Engineer.

Comments and Discussions

 
-- There are no messages in this forum --