This is a migrated thread and some comments may be shown as answers.

Visual Studio incessantly complains that the Pages.g.cs has been modified

12 Answers 650 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Humberto
Top achievements
Rank 1
Humberto asked on 09 Mar 2013, 12:57 AM
Tried recording a test script via the VS (2010) plugin.  Then I tried converting one of the steps to code.  Now when I try to look at the .tstest.cs class in Visual Studio I am INCESSANTLY reminded that the Pages.g.cs file has been modified outside of the source editor.  Regardless of whether I click on Yes/Yes to All/No/No to all, the Microsoft Visual Studio dialog keeps popping up. I can't work!

I even shut down VS 2010 and reloading the Project and it immediately complained of my "dirty" file.  It's impossible for me to have modified the file in any other editor...I don't have it open anywhere else since it's a brand new project I just recorded.

Any suggestions?

12 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 11 Mar 2013, 07:47 AM
Hi Humberto,

The message "This file has been modified outside of the source editor" is usually caused if you accidentally open the Pages.g.cs file in Visual Studio. To overcome this, simply close the Pages.g.cs file and the problem should disappear. See this video for more information. 

All the best,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Humberto
Top achievements
Rank 1
answered on 11 Mar 2013, 01:42 PM
Hi Plamen,

I find this behavior strange!  Is it new in the latest version of Telerik Test Studio?  Or the Visual Studio plugin?  I know in previous versions I could have Pages.g.cs open without any problem.  What if I do want to have it open and what if I do want to modify it so I can change some of the "cryptic" names generated by the recorder? How do I go about doing that?

I find it odd that the dialog box complains that the file has been modified in an outside editor...when that is clearly not the case.  Not modified.  Not even open in an outside editor.  Is this meant/done to discourage inspection of that class?
0
Humberto
Top achievements
Rank 1
answered on 13 Mar 2013, 10:03 PM
Plamen? Anyone?

So any kind of modification I make to the Pages.g.cs class is immediately discarded if I say "yes" to reloading it?  Regardless of whether I modify it in VS or any other text editor?

This is different than the last version of the plugin I was using...which was about a year old.  Right now I have version 2012.2.1420.0 of TTS. Don't know how to see what version of the VS plugin I have.

Why can't I keep the intentional changes I've made to the Pages.g.cs file?
0
Humberto
Top achievements
Rank 1
answered on 13 Mar 2013, 10:11 PM
Does upgrading Telerik's Test Studio also automagically update the Visual Studio plugin?
0
Plamen
Telerik team
answered on 14 Mar 2013, 11:34 AM
Hello Humberto,

Yes, when you upgrade the Test Studio version our installer will also upgrade the Visual Studio plugin accordingly. You can verify that in the Project Settings in Visual Studio(see screenshot). Regarding the 'Pages' issue, we already have an existing bug logged on this behavior. You can track its progress here: Public URL.

Because Pages.g.cs is nearly constantly being automatically re-generated, any changes you attempt to make to it will be discarded. Test Studio stores the elements in the Element Repository during recording and each element is stored along with the necessary Find Logic. Test Studio keeps all of this information into the XML formatted .tstest file and based on that .tstest file Test Studio generates the Pages.g.cs file. If you want to change the name of an element the correct way to do that is via the Elements Explorer.

Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Humberto
Top achievements
Rank 1
answered on 14 Mar 2013, 05:04 PM
Thank you Plamen, I appreciate all the candid answers and gritty details.

I am curious if this "pages.g.cs is nearly always being regenerated" has always been the case? Or is it something new to current versions of Telerik Test Studio and/or the Plugin?  In other words, I was under the impression that the autogenerated Pages.g.cs file was only created once.

Again, thanks Plamen.
0
Ewin
Top achievements
Rank 1
answered on 14 Mar 2013, 05:30 PM
This is extremely annoying as I have several elements to edit and going through the element explorer is time consuming. 

I just try to open the page.g.cs to find and replace some of the htmlfindexpressions so I can do a quick replace. 

@Plamen, do you have an estimate when this http://feedback.telerik.com/Project/117/Feedback/Details/41933-pages-g-cs-seems-to-be-needlessly-regenerated will be resolved?
0
Humberto
Top achievements
Rank 1
answered on 14 Mar 2013, 05:49 PM
Hello Ewin,

I'm not sure it's going to get resolved like you want it to.  I may be wrong and Plamen might be able to clarify...but I've also noticed that every time I open up the project/solution in Visual Studio...the Pages.g.cs file is regenerated once again!  You're not asked...you just notice that your mods to that file are now gone...and your project will not compile.

Agree that going through the Element Explorer is tedious and time consuming...especially for those of us that are quite comfortable in VS. I've also noticed, maybe I did it wrong, that via the Elements Explorer panel, I rename an element and it is correctly renamed in the 2 places where it exists in the Pages.g.cs file BUT NOT in the associated/accompanying other class (.cs file) that then uses the UI elements to run the actual test of say...clicking, verifying the element exists, is visible, etc.

So even via the Elements Explorer panel, your project is rendered uncompilable until you fix the new names of the elements throughout!

I don't remember this being an issue/case with previous versions.  But then again it could have been a bug that the system wasn't enforcing such rigorous "hand slap don't touch the Pages.g.cs" measures.

Annoying? Yep! Makes me want to revert to the old version of Telerik Test Studio I was using.
0
Plamen
Telerik team
answered on 15 Mar 2013, 12:25 PM
Hi,

@Humberto
I can assure you that reverting back to an older version of Test Studio will not solve this problem. Currently(it has always been like this) when you rename an element in Elements Explorer, the code behind file that uses this element will not reflect that change. We have a bug on this behavior, which you can track here: Public URL.

@Ewin
As I stated in my previous reply, Test Studio keeps all the info for the elements into the XML formatted .tstest file and based on that .tstest file Test Studio generates the Pages.g.cs file. When the bug is fixed the Pages.g.cs file will not be needlessly regenerated, but it will be still regenerated on each test execution taking the info from the .tstest file. I don't really recommend it, but in theory you could hack the .tstest file to change the elements find expressions. That would change it permanently. However, officially I'm NEVER supposed to recommend this approach.

Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Pam
Top achievements
Rank 1
answered on 30 Jan 2014, 10:06 PM
I hope this bug is fixed since most of the testers are used to modifying codes generated by automation tools, just like CodedUI. It would really be very helpful if we could open the Pages.g.cs without any problem. One major problem for this bug is, when you right click your step, the first option is Customized Step-in code, which is very easy to click by any person who might not have any idea what it will do. Once the file is opened, and you click cancel or no, the file is deleted, the step is also deleted which would break the whole test. It's a pain. It's more painful to tell each tester to 'NOT' choose the Customized step-in code. 
0
Ivaylo
Telerik team
answered on 05 Feb 2014, 08:32 AM
Hello Pam,

If you are referring to this particular issue, this has been already fixed. 

You can always give it a try by installing the latest version of Test Studio.

Regards,
Ivaylo
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Manu
Top achievements
Rank 1
answered on 12 Jan 2016, 04:18 AM

I'm still facing this issue. Whenever I make a change in the code in the Code Viewer and save the changes, the prompt will appear and after clicking Yes, it's undoing my changes. I'm using the latest version of TestStudio.

 It's really annoying and my work is completely stopped because of this issue.

Tags
General Discussions
Asked by
Humberto
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Humberto
Top achievements
Rank 1
Ewin
Top achievements
Rank 1
Pam
Top achievements
Rank 1
Ivaylo
Telerik team
Manu
Top achievements
Rank 1
Share this question
or