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.
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.
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.
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.
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.
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.
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.
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.
Re: [RESOLVED] I have a problem with Visual Studio.
Originally Posted by jmcilhinney
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.
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.
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.
Re: [RESOLVED] I have a problem with Visual Studio.
Originally Posted by jmcilhinney
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.
Along with the sunshine there has to be a little rain sometime.
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:
WindowState = CType(2, FormWindowState)
Why would you do that instead of this:
vb.net Code:
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.
Re: [RESOLVED] I have a problem with Visual Studio.
Originally Posted by jmcilhinney
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:
WindowState = CType(2, FormWindowState)
Why would you do that instead of this:
vb.net Code:
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.
Re: [RESOLVED] I have a problem with Visual Studio.
Originally Posted by Poppa Mintin
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.