Error "Type or namespace name expected" with Page object

6 posts, 0 answers
  1. Totti
    Totti avatar
    10 posts
    Member since:
    Sep 2010

    Posted 16 Feb 2011 Link to this post

    Hello,
    I created new any project test --> Add new a *.aii file in the project --> Add code behind to this *.aii file, after that I always received  Error "Type or namespace name expected" with Page object  in my code behind but build source code still successfully. (See attached pic file)
    I'm using WebUI_TestStudio_Developer_2010_3_1213_Trial.msi

    So Is it normal ? Do you have idea for this ?
    Many thanks.
  2. Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 16 Feb 2011 Link to this post

    Hello Totti,
        don't worry about this. "Pages" is generated dynamically. We're not sure why yet, but occasionally Visual Studio will "forget" this and will list "Pages" as missing. In any case, this is not a problem and it won't interfere with your work.

    Try replacing the two instances of "Pages" with "TestProject.Pages" - this way the errors might not appear.

    Let me know whether this works!

    All the best,
    Stoich
    the Telerik team
  3. Temesgen Meheret
    Temesgen Meheret avatar
    14 posts
    Member since:
    Mar 2010

    Posted 04 May 2011 Link to this post

    This happens because pages.g.cs is not automatically included in the project. Do show all files on visual studio and include this file in project. That will take care of the compilation errors..
  4. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 04 May 2011 Link to this post

    Hello Temesgen Meheret,

    Please do NOT add the pages.g.xx file to your project. While doing so will get rid of the warning that JustCode and Resharper shows, you will end up with a compile error complaining about duplicate Pages definitions.

    All the best,
    Cody
    the Telerik team
    Do you think you know all the new features coming out in Test Studio R1 2011? Think again - we have some surprises and will share them with you in the What's New in Test Studio R1 2011 Webinar on May 12th.
    Register Today!
  5. Temesgen Meheret
    Temesgen Meheret avatar
    14 posts
    Member since:
    Mar 2010

    Posted 05 May 2011 Link to this post

    Right. I actually got the error after including it. But it took down the compilation error to only one error where as it was showing compilation error on all places that were referencing Pages before adding this file to the project.

    So what are the right procedures when converting the test to code because it is giving errors either ways.
  6. Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 12 May 2011 Link to this post

    Hi Temesgen,
        there really is no special approach that you'll need to follow when working with Coded steps. Check out our section on this in the user's guide:
    http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/coded_steps.aspx 

    All the best,
    Stoich
    the Telerik team
    Do you think you know all the new features coming out in Test Studio R1 2011? Think again - we have some surprises and will share them with you in the What's New in Test Studio R1 2011 Webinar on May 12th.
    Register Today!
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!