Click here to Skip to main content
Click here to Skip to main content

Coded UI tests: Visual Studio Crashed while moving code from UIMap.Designer.cs to UIMap.cs from Coded UI Test Editor

, 10 Dec 2012
Rate this:
Please Sign up or sign in to vote.
Few days ago I encountered an error. When I try to move a recorded function from UIMap.designer.cs to UIMap.cs, visual studio got 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 prev

Few days ago I encountered an error. When I try to move a recorded function from UIMap.designer.cs to UIMap.cs, visual studio got 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.

*******************************************************************************
 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….

**********************************************************************
    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)

About the Author

joinsaad
Tester / Quality Assurance
Pakistan Pakistan
Working as a Testing Automation Engineer.
Follow on   Google+

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web04 | 2.8.140718.1 | Last Updated 10 Dec 2012
Article Copyright 2012 by joinsaad
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid