Results 1 to 26 of 26

Thread: [RESOLVED] I have a problem with Visual Studio.

  1. #1

    Thread Starter
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Resolved [RESOLVED] I have a problem with Visual Studio.

    Somewhat of a disaster has struck ! Yesterday I ran the latest up-date on Visual Studio and now a program that I want to work on doesn't work in debug. This morning another up-date appeared, I figured it was something in yesterday's up-date had gone wrong and this was a fix. But it's still not fixed. Trial projects associated this the particular program won't run either.

    Yesterday I also ran a 'Computer clean-up' program, one I've used for at least ten years, so maybe that's taken a dislike to something and deleted it. I've just re-installed Visual Studio and still none of those programs work, so I don't believe it was something in there. Other current projects seem not to be affected.

    In this particular project for example, IntelliSense complains that... "Type Int32 is not defined" likewise, types: PictureBox, Image and Color, amongst others are "not defined".

    What is likely to have been corrupted or deleted in this group of projects?

    I'd hate to have to try to re-produce this particular program, it's only a month or so since I completed it but trying to remember everything in there would be difficult, to say the least.


    Poppa.
    Along with the sunshine there has to be a little rain sometime.

  2. #2
    Addicted Member Goggy's Avatar
    Join Date
    Oct 2017
    Posts
    196

    Re: I have a problem with Visual Studio.

    Your missing your project scoped references.
    Goto you project properties, to tab references, and check things like "system" references.
    Utterly useless, but always willing to help

    As a finishing touch god created the dutch

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: I have a problem with Visual Studio.

    Goggy's explanation sounds plausible. You can check out an existing project that works or a new project to see what you need. You may be missing the fundamentals like mscorlib and Microsoft.VisualBasic.

  4. #4

    Thread Starter
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Re: I have a problem with Visual Studio.

    Thanks for the replies guys...

    I can't find any differences between working code and the faulty ones... but I expect I'm looking in the wrong places.

    I can find several instances of such reference to Microsoft.VisualBasic such as:
    Code:
    Namespace My
        
        <Global.Microsoft.VisualBasic.HideModuleNameAttribute(),  _
    But I don't see 'mscorlib' in any of the projects, working or otherwise.


    Poppa.
    Along with the sunshine there has to be a little rain sometime.

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: I have a problem with Visual Studio.

    It's not about the code. Open the References page of the project properties and check the assembly references there. It sounds like it's those that are missing for some reason.

  6. #6

    Thread Starter
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Re: I have a problem with Visual Studio.

    Thanks Jmcilhinney

    I did check those at the same time as everything else, but as they were the same for a working project as those of a non-working one I didn't mention it.

    Both projects have:
    References:

    System
    System.Core
    System.Data
    System.Data.DataSetExtensions
    System.Deployment
    System.Drawing
    System.Net.Http
    System.Windows.Forms
    System.Xml
    System.Xml.Linq

    And the same 1st 11 boxes are 'ticked' in: Imported namespaces.
    (And no others)


    Poppa.
    Along with the sunshine there has to be a little rain sometime.

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: I have a problem with Visual Studio.

    It looks like mscorlib and Microsoft.VisualBasic aren't listed on the References page, presumably because they are essential and cannot (in theory) be removed. If you open the Object Browser from the View menu in a working project, you should see those two assemblies listed first, before the ones you listed. If you do the same in your broken project, do you see those two assemblies listed?

    I just checked and mscorlib and Microsoft.VisualBasic are listed in the Reference Manager dialogue so you may be able to add the references back if they are indeed missing.

  8. #8

    Thread Starter
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Re: I have a problem with Visual Studio.

    Nice try...

    They're both listed there.

    They weren't actually first, but clicking the first item opened a new list and they were both 'Top of the list'.

    Does that put me back to square one ?



    Poppa.
    Along with the sunshine there has to be a little rain sometime.

  9. #9
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: I have a problem with Visual Studio.

    Have you tried creating a new project, verifying it works, then comparing that to things?

    Could you possibly zip your project and give us a copy?

    Have you tried Build>Clean followed by another build?

    Have you tried checking a previous version out of source control and building that?
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

  10. #10

    Thread Starter
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Re: I have a problem with Visual Studio.

    Quote Originally Posted by Sitten Spynne View Post
    Have you tried Build>Clean followed by another build?
    Thanks Sitten Spynne, I didn't think I could do anything with it whilst I couldn't open the Form1.vb[Design].

    Clean worked immediately ! all the red wriggly lines disappeared, I clicked 'Start' and it all just ran as it used to.

    I shall certainly bear that in mind if I ever have a similar problem.


    Poppa.
    Along with the sunshine there has to be a little rain sometime.

  11. #11
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: [RESOLVED] I have a problem with Visual Studio.

    What probably happened:

    When you build, a lot of "in between" files get generated that get glued together to make the final outputs. VS tries to make builds faster by sometimes not rebuilding those "in between" files if it thinks they don't need to change. But a lot of those files are also vital for detecting errors.

    The update probably changes the format of those "in between files", which confused Intellisense and everything else. For whatever reason, VS was confused enough it decided not to rebuild those files. "Build Clean" tells VS to for sure delete everything, so you get a slower build immediately after, but it's "guaranteed" to have no lingering ghosts.

    Or, at least, if the ghosts don't go away after "Build Clean", you know that's not where the ghosts were hiding.
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

  12. #12

    Thread Starter
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Re: [RESOLVED] I have a problem with Visual Studio.

    Thanks again Sitten Spynne that's pretty clear, I've never used 'Clean' previously, next time I get a 'Won't open properly' problem I'll try that first.

    It was strange that it was only the several test programs, all associated with the same project which were affected. It was the final application I wanted to get to and the one I 'Cleaned' I really ought to see if the others are still affected or need cleaning too.

    Oh !
    Now that's weird. I just opened two of the other 'affected' applications:

    1. They're still 'affected'. Not really a surprise.
    2. Build > Clean doesn't fix 'em, even after several attempts, and... weirdest of all...
    3. They both run correctly !


    Poppa.
    Along with the sunshine there has to be a little rain sometime.

  13. #13
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: [RESOLVED] I have a problem with Visual Studio.

    It may or may not help but try deleting the bin and obj folders completely from the project folder. The obj folder is where the intermediate files that Sitten Spynne mentioned get saved and the bin folder is where the final output gets saved. It's possible that a file or two there has got stuck and cleaning doesn't help. In theory, cleaning should empty both folders but it doesn't always work.

  14. #14

    Thread Starter
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Re: [RESOLVED] I have a problem with Visual Studio.

    Quote Originally Posted by jmcilhinney View Post
    It may or may not help but try deleting the bin and obj folders completely from the project folder. The obj folder is where the intermediate files that Sitten Spynne mentioned get saved and the bin folder is where the final output gets saved. It's possible that a file or two there has got stuck and cleaning doesn't help. In theory, cleaning should empty both folders but it doesn't always work.
    Thanks Jmcilhinney,

    I deleted both folders. Then opened that project in VS 2017... Latest update.

    These types were all showing error 'Not defined:
    Chr
    Color
    ContentAlignment
    Button
    DockStyle
    FormWindowState
    Int32
    Label
    Len
    Point

    First I ran the Clean... Still errors. Then I ran the code... Worked correctly... Everything listed still showing errors.

    Then I did the whole thing again... no change... still runs ok.


    Poppa.
    Along with the sunshine there has to be a little rain sometime.

  15. #15
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: [RESOLVED] I have a problem with Visual Studio.

    Name:  timezone.jpg
Views: 189
Size:  17.6 KB
    Beware of sign posts ahead... and people named Rod Serling.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  16. #16
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: [RESOLVED] I have a problem with Visual Studio.

    If it runs without doing any build work, then the /bin folder is not deleted.

    If it is doing build work and running, double-check the /bin folder is deleted.

    If that's true, then congratulations! Your VS install is corrupt and Intellisense is broken. Try repairing, reinstalling, and formatting and reinstalling in that order.

    But before anything drastic, zip up one of the failing projects and let us see. If it's broken on our machines too, maybe we'll figure out why.
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

  17. #17

    Thread Starter
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Re: [RESOLVED] I have a problem with Visual Studio.

    Quote Originally Posted by Sitten Spynne View Post
    But before anything drastic, zip up one of the failing projects and let us see. If it's broken on our machines too, maybe we'll figure out why.
    Ok, this one has several instances of the error.

    Poppa.
    Last edited by Poppa Mintin; Dec 9th, 2017 at 09:42 PM. Reason: Attachment removed.
    Along with the sunshine there has to be a little rain sometime.

  18. #18

    Thread Starter
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Re: [RESOLVED] I have a problem with Visual Studio.

    Quote Originally Posted by Poppa Mintin View Post
    Ok, this one has several instances of the error.

    Poppa.
    Ooops... Sent wrong file !

    Poppa.
    Last edited by Poppa Mintin; Dec 9th, 2017 at 09:42 PM. Reason: Attachment removed.
    Along with the sunshine there has to be a little rain sometime.

  19. #19
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: [RESOLVED] I have a problem with Visual Studio.

    I haven't actually looked but, judging by the sizes of those attachments, you haven't deleted the bin and obj folders before uploading. As we've said, those folders contain binaries and attaching binaries is not allowed by site rules. If that is the case then you should remove those attachments, delete those folders, create a new ZIP file and attach that.

  20. #20

    Thread Starter
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Re: [RESOLVED] I have a problem with Visual Studio.

    Quote Originally Posted by jmcilhinney View Post
    I haven't actually looked but, judging by the sizes of those attachments, you haven't deleted the bin and obj folders before uploading. As we've said, those folders contain binaries and attaching binaries is not allowed by site rules. If that is the case then you should remove those attachments, delete those folders, create a new ZIP file and attach that.
    Yeah, you're right. I didn't notice I was supposed to remove those files. Herewith the complete file folder but without .bin or .obj files.



    Poppa.
    Attached Files Attached Files
    Along with the sunshine there has to be a little rain sometime.

  21. #21

    Thread Starter
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Re: [RESOLVED] I have a problem with Visual Studio.

    Quote Originally Posted by jmcilhinney View Post
    If that is the case then you should remove those attachments, delete those folders
    I tried to delete the attachment in the previous post, I could edit the text but couldn't find how to delete the attachment.

    I need to delete the attachment in the two previous posts.


    Poppa.
    Along with the sunshine there has to be a little rain sometime.

  22. #22

    Thread Starter
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Re: [RESOLVED] I have a problem with Visual Studio.

    Quote Originally Posted by Poppa Mintin View Post
    I tried to delete the attachment in the previous post, I could edit the text but couldn't find how to delete the attachment.

    I need to delete the attachment in the two previous posts.


    Poppa.
    OK, I found how to do it.

    Pop.
    Along with the sunshine there has to be a little rain sometime.

  23. #23
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: [RESOLVED] I have a problem with Visual Studio.

    I just opened that solution and I was able to open the form in both code and designer view without issue.

    On an unrelated note, I'd probably code a few things differently but the one that immediately jumped out at me was this line:
    vb.net Code:
    1. WindowState = CType(2, FormWindowState)
    Why would you do that instead of this:
    vb.net Code:
    1. WindowState = FormWindowState.Maximized
    If nothing else, the latter is self-documenting. I had no idea what state you were setting because I didn't know what 2 represented but it's obvious if you use the actual enumerated field.

  24. #24

    Thread Starter
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Re: [RESOLVED] I have a problem with Visual Studio.

    Quote Originally Posted by Sitten Spynne View Post
    Try repairing, reinstalling, and formatting and reinstalling in that order.
    I tried 'Repair' which didn't seem to do anything... then I re-installed VS2017 and all is now well.


    Thanks for the help guys


    Poppa.
    Along with the sunshine there has to be a little rain sometime.

  25. #25

    Thread Starter
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Re: [RESOLVED] I have a problem with Visual Studio.

    Quote Originally Posted by jmcilhinney View Post
    I just opened that solution and I was able to open the form in both code and designer view without issue.

    On an unrelated note, I'd probably code a few things differently but the one that immediately jumped out at me was this line:
    vb.net Code:
    1. WindowState = CType(2, FormWindowState)
    Why would you do that instead of this:
    vb.net Code:
    1. WindowState = FormWindowState.Maximized
    If nothing else, the latter is self-documenting. I had no idea what state you were setting because I didn't know what 2 represented but it's obvious if you use the actual enumerated field.
    I've used 'WindowState = 2' since it was suggested to me in this forum several years ago, and working with code which I know works seems to be a sensible way to go. However when I discovered Option Strict wasn't on and corrected that, Intellisense 'Fixed' that code. Since then I've discovered the more explicit form of the code and used that.

    This was only an early test piece from a while ago, the completed application which I wanted to access when this problem arose does use 'Maximized'.


    Poppa.
    Along with the sunshine there has to be a little rain sometime.

  26. #26
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: [RESOLVED] I have a problem with Visual Studio.

    Quote Originally Posted by Poppa Mintin View Post
    I've used 'WindowState = 2' since it was suggested to me in this forum several years ago, and working with code which I know works seems to be a sensible way to go. However when I discovered Option Strict wasn't on and corrected that, Intellisense 'Fixed' that code. Since then I've discovered the more explicit form of the code and used that.

    This was only an early test piece from a while ago, the completed application which I wanted to access when this problem arose does use 'Maximized'.


    Poppa.
    Forums are the bathroom wall of code. Not everything you find is a gem. I can't tell you how many times I see this:
    OP> "I want to do X."
    1> "Here's a long explanation, this is hard. <long code sample>"
    2> <2-line solution that only works on Tuesday>
    1> "That's not a good idea because <reasons>."
    OP> "Hey thanks, (2), it doesn't seem to be working but I'm going to use it anyway in case someone posts something else that works."
    2> "I've done this for 10 years and it works fine, maybe <3-line version that works on Tuesdays and Saturdays.>"
    ... [500 posts later] ...
    3> <copy/pastes post #2>
    OP> "OH! That works!"
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width