Results 1 to 10 of 10

Thread: VB in VS2017 Blue Screen of Errors problem/question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2017
    Posts
    72

    VB in VS2017 Blue Screen of Errors problem/question

    This showed in the previous version as well but I see no fix other than to recreate the form or the entire project. I see no pattern to diagnose or reproduce the problem.

    As you can see, the screen gives me an error that I can check but ot goes to a code window that contains code that neither I nor the student have entered.

    Can someone explain what all this is about?

    Name:  BSOE code.jpg
Views: 502
Size:  56.5 KB
    ====
    Name:  BSOE.jpg
Views: 432
Size:  25.7 KB

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

    Re: VB in VS2017 Blue Screen of Errors problem/question

    The Designer code file is system-generated and contains the code that corresponds to what you do in the designer. If you add a TextBox to your form in the designer then code is added to the designer code file to create and configure that control and add it to the form.

    The class declaration for your form in the designer code file is Partial, which means that you can add other code files containing parts of the same class and they will be all compiled to a single class.

    Based on the error messages there, it looks as though the entire class definition from the designer code file has been duplicated somehow. The first one says that the DesignerGenerated attribute cannot be applied multiple times, which suggests that that partial file has been duplicated, complete with attribute. Se if there is another similar error message further down the list that leads to a different line of code. If there is then that will lead you to the duplicate partial class, which you should be able to delete to fix the issue.

  3. #3
    Hyperactive Member Mike Storm's Avatar
    Join Date
    Jun 2017
    Location
    Belgium
    Posts
    425

    Re: VB in VS2017 Blue Screen of Errors problem/question

    Hi,
    I have seen this happening in VS 2017 Community working with inherited controls like TabControl, or also if using usercontrols, but its more frequent when you add a databound control by drag and drop from the datasources and then you decide that thats not exactly what you want and delete it and add it again, sometimes also fires a error messagebox that you can not save the file couse was modified on a external editor or its open somewhere else, the way around i found for that was to when i have to delete a databound object, also delete all the table adapters/datasets/bindingsources on the bottom of the window and save the form before adding again.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Apr 2017
    Posts
    72

    Re: VB in VS2017 Blue Screen of Errors problem/question

    What is said here is all well and good, and i actually understand most of it. However, this is a beginner's class and all they have used so far is a few buttons, a few labels, colors from the properties menu and in code, and in some cases multiple forms. The code is extremely simple using statements such as Case, if-then, and recently a subroutine call.

    How might be possible to generate errors so sophisticated and what do we do to recover from them? So far, I am telling the students to scrap all their work and start over.

    Anticipating these VB peculiarities, I have them do sequential backups with revision numbers and to copy the code into a word document. Granted it is good programming practice but it really shakes the student's confidence in the VB program itself.

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

    Re: VB in VS2017 Blue Screen of Errors problem/question

    VS is a complex piece of software and, like all software, contains a number of bugs. I've seen things like this happen from time to time but, in the grand scheme of things, not very often. Is this happening to multiple people or to one person multiple times? If so then something may be corrupt and a repair of VS may be in order. If it's just happened the once then it may well be an isolated incident that you'll never see the like of again. Of course, it is possible that someone did something silly and either didn't realise it or isn't owning up to it. Something may have been dragged and dropped that shouldn't or something like that. You may never know the cause, particularly if it doesn't happen again.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Apr 2017
    Posts
    72

    Re: VB in VS2017 Blue Screen of Errors problem/question

    It seems to be random and rare.

    Relates or not: I have also seen two situations now, separate computers/students where in creating a button, it is flagged as an improper property value or something like that. I can create the error if I have a name of the object and place a space in it but that is not the case. "btn2" for example fails after "btn1" exists.

    I have also seen 9 buttons get reset to default values. "btn1", "btn2",... "btn9" set back to "button1", "button2", ... "button9" This, however, I have seen only once and have no ides what the student had done prior to my seeing this. It happened while I was helping the student recover from the blue error page.

    None of these incidents are restricted to one computer or one student.
    Last edited by GarySut; Oct 6th, 2017 at 05:55 AM. Reason: clarification

  7. #7
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,990

    Re: VB in VS2017 Blue Screen of Errors problem/question

    For the original problem, is there any chance that students are copying files from one project to another, or copying them from a different student? I haven't tried it, but I would expect this problem to exist in some such cases. Every form has a .designer.vb file associated with it. What you are showing is the .designer.vb file for frmStates. Normally, this would be named frmStates.designer.vb, but it doesn't HAVE to be. If a student copied the .designer.vb file into their project folder from some other project, and that project also had a partial class for frmStates, then you should get this issue. I would expect that, in that case, you'd see it if you were looking in Solution Explorer with Show All Files selected. Normally, in that case, there would be a plus beside each form, which would expand to show three files. If you have one that expands to show four files, with either multiple .designer.vb or multiple .vb files, then that may be the problem.
    My usual boring signature: Nothing

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

    Re: VB in VS2017 Blue Screen of Errors problem/question

    Since it says the problem is on line 25, it would've been helpful if your screenshot didn't end at line 24.

    But re: the "How do I prevent this?" question, you can't really. Let me edit in some suggestions.

    Programming projects are prone to disaster. Ignoring visual studio bugs, the only way we can implement new features is to change our nice, working code files. Sometimes when we do that we end up with bad, broken files. This is the first thing beginner programmers should learn: your files are going to get screwed up and if you don't plan for that you're going to lose a TON of work one day, guaranteed. We see "Oh no my project is corrupted how do I get my form back?" here about once every other month. There's not always an answer.

    So the second or third thing budding programmers should learn about is source control. Most people think that means TFS, and say "I don't have the money". The vast majority of professional developers would never use TFS and instead use Git or Mercurial. Both are free, both are easy to install, and both run on your computer without needing expensive Windows Servers. There's literally dozens of other free solutions, but Git and Mercurial stand out as the most popular. There's a good Mercurial tutorial at http://hginit.com. Send your students to it.

    Source control is like a database for source code versions. When you have working code, you commit. Then you make changes. If you don't like changes, you revert, and get your working files back. Or, if it's broken, but you're not sure if you can do better, you can branch, commit to a new branch, then revert to the main code and try again, going back to the branch if it turns out you can't do better. If VS eats one of your files and corrupts it, you revert and you're done.

    If you really, really, really don't want to work with source control, the next-best advice is to use zip files. Every day, before you start working, right-click your project file and create a zip file out of it. Put the date on it, then go do your work. If you get a lot of work done and are about to make big changes, make another zip file. If something goes wrong and things get corrupted, you can always delete everything, then unzip the zip file.

    If a student ignores both of those pieces of advice, they're eventually going to find themselves the victim of a bug that corrupts their project. It always seems to happen right before the due date. People who go on to be professional programmers learn "I'm never working without source control again" from it.
    Last edited by Sitten Spynne; Oct 6th, 2017 at 10:40 AM.
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Apr 2017
    Posts
    72

    Re: VB in VS2017 Blue Screen of Errors problem/question

    Quote Originally Posted by Shaggy Hiker View Post
    For the original problem, is there any chance that students are copying files from one project to another, or copying them from a different student? .
    I would consider that but these students are not all that sophisticated. Besides, this is an in-class lecture and the entire project was created that day. Also, I was helping the student with a different problem and these as mentioned, kicked in as I was watching.

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Apr 2017
    Posts
    72

    Re: VB in VS2017 Blue Screen of Errors problem/question

    Quote Originally Posted by Sitten Spynne View Post
    Since it says the problem is on line 25, it would've been helpful if your screenshot didn't end at line 24.

    If you really, really, really don't want to work with source control, the next-best advice is to use zip files. Every day, before you start working, right-click your project file and create a zip file out of it. Put the date on it, then go do your work. If you get a lot of work done and are about to make big changes, make another zip file. If something goes wrong and things get corrupted, you can always delete everything, then unzip the zip file.
    I missed it by "that much..."
    I will see if I can get a new shot.

    As for zip files, that is exactly what I am doing and I take it one step further. The working file has a version number that gets incremented for each zipping. That way, they zipped files are saved sequentially. Zips might automatically increment I prefer the original to be incremented. I have them do this often even during one coding session

    These are not programmers and will never be. They take this course only because it is entered as a Math credit so for most of them, this is one shot at anything near programming.

    The one time this is most likely to happen is during a lecture and I really cannot take time to address the needs of one student.

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