locked
Error indicators in VS 2017 RRS feed

  • Question

  • User1510859543 posted

    I have been using VS 2017 Pro for a long time and today, when I opened a website page and code-behind page I am getting errors noted below.

    When looking at a page in the web designer it is showing red squiggly lines under some items in the code.  I was just working on this project yesterday and all was fine.  Below are 2 examples of errors I am seeing and need help resolving this. Note that I did not do any changes to my configuration on my PC.

    Dim IDToFind As Int32 = 0
    'shows red line under Int32 with mouseover message "Type Int32 is not defined"
    
    'another line below shows red line under txtLineID with mouseover message "txtLineID is not declared. It may be inaccessible due to its protection level.
    txtLineID.Text = intLineID.ToString

    Monday, October 15, 2018 5:32 PM

Answers

All replies

  • User475983607 posted

    Dim IDToFind As Int32 = 0 'shows red line under Int32 with mouseover message "Type Int32 is not defined"

    The Int32 is a type in the language.   The editor is telling you that the class file does not "Import" the namespace that contains the Int32 type. 

    https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/error-messages/type-typename-is-not-defined

    This error... 

    'another line below shows red line under txtLineID with mouseover message "txtLineID is not declared. It may be inaccessible due to its protection level. txtLineID.Text = intLineID.ToString

    generally means you've messed with the page directive which has pointers to the code behind and designer file.   They use the same partial class name.  Simply the code behind cannot find the definition for the textbox.  

    Sometimes VS take a moment to get initialized but it should eventually straighten itself out.  If it does not then you've more than likely made a change but forgot.  Hopefully, you are using source control and can compare yesterday's changes to figure out what changed.  

    Monday, October 15, 2018 6:27 PM
  • User1510859543 posted

    The only thing I did was remove Visual Studio 2010 as I do not need that anymore.  I also removed some F# thing since I do not use F#.

    Monday, October 15, 2018 6:41 PM
  • User1510859543 posted

    The same errors are happening on a completely separate PC using the same website...if that helps.

    Monday, October 15, 2018 8:08 PM
  • User475983607 posted

    The same errors are happening on a completely separate PC using the same website...if that helps.

    The same error should/will popup if the class file is missing the Imports statement and the page directive is messed up.  It sounds like you've made changes and forgot... We've all done that.  This is where source control is a big help because you can compare a date (or check in) when the code behaved as expected to the current source file.

    Monday, October 15, 2018 8:14 PM
  • User1120430333 posted

    Sometimes, VS goes haywire,  and you have to do a Clean and Rebuild of the solution to get rid of bogus compile error or bogus red line errors.

    Tuesday, October 16, 2018 12:36 AM
  • User1510859543 posted

    I did a rebuild and it was clean and problems still exists (see results below).  Is there something erroneous in web.config or???

    ----- Rebuild All started: Project: BodyShop, Configuration: Debug Any CPU ------
    Validating Web Site

    Validation Complete
    ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

    Tuesday, October 16, 2018 2:38 PM
  • User1510859543 posted

    This is a customers site and it is not under source control.  Please help as VS 2017 is mostly toast until this is resolved. I had something like this before and I just opened as administrator and problem went away but is not this time.

    Tuesday, October 16, 2018 5:50 PM
  • User475983607 posted

    dlchase

    This is a customers site and it is not under source control. 

    Not good...

    dlchase

    Please help as VS 2017 is mostly toast until this is resolved.

    But you opened the project on another machine and had the same problem.  I doubt it's Visual Studio.  Perhaps place the project on GIT, which is source control, and someone can take a look.

    If you really feel Visual Studio is to blame, then reinstall or repair Visual Studio.

    Does the project run on the development machine?  Or do you get the same error shown in the VS editor?  Have you tried the fully qualified alias name?

    System.Int32

    https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/built-in-types-table

    Tuesday, October 16, 2018 5:56 PM
  • User1510859543 posted

    There are no problems on the development machine.  If I open VS 2017 and the website from there I do not get the red underlines on the code behind pages.

    In this case the lack of source control is not an issue (maybe) since even pages that did not change are showing up with issues in my VS.

    Tuesday, October 16, 2018 6:42 PM
  • User475983607 posted

    dlchase

    There are no problems on the development machine.  If I open VS 2017 and the website from there I do not get the red underlines on the code behind pages.

    Now I'm lost.  The development machine is error free but other machines have copies of the source code and those machines have the errors?

    dlchase

    In this case the lack of source control is not an issue (maybe) since even pages that did not change are showing up with issues in my VS.

    Source control centralizes the code base.  Every machine that updates the code gets a copy from source control.  Any changes are documented and checked in.  This keeps the code changes organized.

    It seems that there are multiple copies of the source floating around which is a potential nightmare.  As far as I'm concerned, if the development machine compiles and runs the code as expected then there's no issues.

    Tuesday, October 16, 2018 7:00 PM
  • User1510859543 posted

    There are only 2 copies of the source code - production and test.  Production is at user site and test is at our site so all Visual Studio 2017 programs here are opening the web site source code from the IIS machine here in a shared folder.

    mgebhard

    It seems that there are multiple copies of the source floating around which is a potential nightmare.  As far as I'm concerned, if the development machine compiles and runs the code as expected then there's no issues.

    Except that I cannot get code typing help, etc. on the source code here at test site.

    Tuesday, October 16, 2018 7:14 PM
  • User475983607 posted

    Except that I cannot get code typing help, etc. on the source code here at test site.

    Try creating a test project to verify if the Intellisense issue is related to Visual Studio or the project.

    Tuesday, October 16, 2018 7:35 PM
  • User1510859543 posted

    It must be related to the project.  I opened up 2 completely different projects (pointing to same IIS server) and one was fine and the other had same errors/issues.  Hope this helps.

    Tuesday, October 16, 2018 7:57 PM
  • User475983607 posted

    It must be related to the project.  I opened up 2 completely different projects (pointing to same IIS server) and one was fine and the other had same errors/issues.  Hope this helps.

    I'm not sure what we can do from a forum perspective.   It seems that someone messed up a few files in a project.  You'll need to fix the errors.

    Tuesday, October 16, 2018 8:48 PM
  • User1510859543 posted

    What "files" are you referring to?  I get the errors on every page of the solution.

    Tuesday, October 16, 2018 9:18 PM
  • User475983607 posted

    dlchase

    What "files" are you referring to?  I get the errors on every page of the solution.

    I have no idea and cannot see the project/solution.  I assume the project references are messed up.  Someone on your team has to take responsibility and fix the project/solution.  Post the project on GIT if you want community assistance otherwise there's not much we can do.

    https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/error-messages/type-typename-is-not-defined

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 16, 2018 9:30 PM
  • User1510859543 posted

    I would have thought doing a "rebuild" would have pointed out any problems...but I guess not.

    Tuesday, October 16, 2018 11:12 PM