?
Solved

Visual Studio Problem - crashes on opening a file

Posted on 2003-02-20
16
Medium Priority
?
3,122 Views
Last Modified: 2013-12-14
Hi,

I have MS Visual C++ 6.0 and have updated it with the latest service pack (5.0).  However, every so often I will be presented with the following error dialogue

<Dialogue title>
"DevStudio Macro Terminator: msdev.exe - Application error"

<Dialogue contents>
(Standard Error Dialogue Icon (White Cross on Red Circle))
"The Instruction at '<memory address> referenced memory at <address>'.  The memory could not be 'read'.
Click on OK to terminate the program
Click on Cancel to debug the program"

If I click OK, I cannot open MSDEV again until I open the Win2k task manager and kill msdev.exe, a backlog of MSDEVs occur without actually displaying any of them or even the splashscreen for that matter.

This happens when I click a .c or .cpp file to open it for working on; occasionally when I open a .dsw file also.
It does not happen however when I drag one of the afforementioned files into the developer window - the file opens fine.

The most frustrating thing about this is the fact that it does not happen all of the time - just on random occasions.  I have tried reinstalling the program but this has not succeeded in resolving the problem.

Hope someone can tell me what is going on and how I can stop it.

Cheers.
0
Comment
Question by:mrwad99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 3
  • +1
16 Comments
 
LVL 5

Expert Comment

by:Kimpan
ID: 7988912
Try to clean install MSDEV again and install servicepack 5

or if other program crashes too, windows or memory failure?
0
 
LVL 19

Author Comment

by:mrwad99
ID: 7992754
Reinstalling did not help - the error still occurs although not all of the time.

Worrying point you have mentioned about the memory failure - is there any way I can test my RAM for faults ?

Cheers for the advice.
0
 
LVL 5

Expert Comment

by:Kimpan
ID: 7998048
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 2

Expert Comment

by:bkrahmer
ID: 8038438
I have a couple of projects that devstudio loves to crash on as well.  Sometimes, you just have to live with the crap that MS gives us.  Saying that, after every crash, delete the following files in your project directory: *.ncb, *.opt, *.plg, *.aps, *.clw.  Then, do a make clean when you get back in.  And do install SP6.
brian
0
 
LVL 19

Author Comment

by:mrwad99
ID: 8047448
Brian,

SP6 ? I have looked on the Microsoft site and can only find service pack 5 ! Does SP6 exist elsewhere ?

0
 
LVL 2

Expert Comment

by:bkrahmer
ID: 8049755
Sorry, my bad.  SP5 is the latest.  Did you try my suggestion?
brian
0
 
LVL 19

Author Comment

by:mrwad99
ID: 8064306
Yeah I did that Brian and it did not cause a crash the second time.

Why should this make a difference though ?

Cheers.
0
 
LVL 2

Expert Comment

by:bkrahmer
ID: 8069718
It's a bug in visual studio.  Some of the files can get corrupted.

brian
0
 
LVL 19

Author Comment

by:mrwad99
ID: 8070555
Ok, is this documented on the Internet anywhere (probably) and you do not know of any way to *prevent* this beast from happening at all ?

Cheers.
0
 
LVL 2

Accepted Solution

by:
bkrahmer earned 200 total points
ID: 8077715
Dude, I think you are just plain wasting too much time thinking about this (minor) problem.  You can either accept it and move on, or get a different IDE.  End of story.  I'm not trying to sound like a jerk, but spending all of your time trying to figure out why devstudio crashes is like trying to figure out what is wrong with george bush.  I suggest you concentrate instead on making the world a better place by making sure your code isn't buggy and puts users in the same place that you now are.  :)

brian
0
 
LVL 19

Author Comment

by:mrwad99
ID: 8079223
Well, what can I say.  Brian you are straight to the point and raise an excellent issue about my own code.  

I do indeed have better things to do and will use the advice given by yourself previously to solve the problem if it should occur again.

Cheers !
0
 

Expert Comment

by:elegant_dice
ID: 9081451
Hi,

I have the same problem as mrwad99, except that I can consistantly trigger the crash.

Devstudio always crashes when it tries to load up its own workspace, and a perfectly reasonable fread() command fails on a file opened via open() and fdopen().

I've tried installing the service packs of both win2k and VC++ again (not sure if that actually does anything) and since my install disk is elsewhere right now, I can't even try a reinstall.

Any suggestions?

Thanks
0
 
LVL 19

Author Comment

by:mrwad99
ID: 9128565
elegant_dice,

Sorry to hear that you also have the prpblem.  You say that it crashes when you open a file; is this by double clicking on it or does it also do the same if you try and open it from within VC++ or even drag the file into the window ?  If not try that.

I (touch wood) have not had the problem since I had new memory chips put into my computer; I hope the problem was not down to faulty memory but it is a possibility.

Hope you get it sorted anyway.
0
 

Expert Comment

by:elegant_dice
ID: 9129507
Hi again,

Ok, I managed to fix the problem (I think), not completely but at least I can debug my applications again.

Seems that something (application? MS update/patch?) installed a new version of MSVCRT.dll (as usual), but unlike every other library that my applications link to, the debug library MSVCRTD.dll has a different version.   I get the impression that the latest version of MSVCRT.dll has broken some key binary compatibility that my application manages to trip over.

The best solution would be to get the latest msvcrtD.dll, but that does not seem to be available anywhere.   So instead I spent some time and made sure all of my compiled libraries that I link to all link to the same msvcrt*.dll.  ie I have a kept the debug and release versions of what I link far more seperated than before, and I had to play with my QT .pro files to ensure the debug compile uses msvcrtd.dll  (a common niggling problem in the QT qmake compile chain).

Note this doesn't solve the open-.dsp-creates-.dsw-crashes bug, but the .dsw can be opened immediately after the crash successfully anyway, so its not a big problem.



Below is what I added to my .pro file, things to note:
- Keeps ALL the ui/objs seperated into the debug dirs, and NOT allow the objs to be scattered through my source dirs (otherwise you get release and debug objs mixing)
- the CXXFLAGS is the key bit to solve my debug-crash problem
- as the config depends on the debug/release flag, you cannot use the same .dsp project files for both the debug and release version.  You must have a debug .dsp and a release .dsp (but you can batch-compile the debug of debug and release of release in a shared workspace, so its still easy to compile).
- This means you can't do  qmake -after "CONFIG+=debug" to create the .dsp files as the debug flag must be set at the start of the file.  this means calling qmake to build the release, uncommenting +=debug line and calling qmake again to create the debug .dsp.   pain in the butt, but it works.   ideas to make this easier?
- This is the reason for different targets: to write to different .dsp files.


------------------------------------

#win32:CONFIG += debug
win32:TEMPLATE = vcapp
win32:debug {
   INCLUDEPATH += debug/ui
   INCLUDEPATH += debug/obj
   UI_DIR = debug/ui
   MOC_DIR = debug/obj/
   OBJECTS_DIR = debug/obj/
   DESTDIR = debug/

  # dont let it link to msvcrtd.dll
   QMAKE_CFLAGS_MT_DBG  -= -MDd
   QMAKE_CFLAGS_MT_DLLDBG       -= -MDd
   QMAKE_CFLAGS_MT_DBG  += -MD
   QMAKE_CFLAGS_MT_DLLDBG       += -MD

   QMAKE_CXXFLAGS_MT    = $$QMAKE_CFLAGS_MT
   QMAKE_CXXFLAGS_MT_DBG        = $$QMAKE_CFLAGS_MT_DBG
   QMAKE_CXXFLAGS_MT_DLL        = $$QMAKE_CFLAGS_MT_DLL
   QMAKE_CXXFLAGS_MT_DLLDBG= $$QMAKE_CFLAGS_MT_DLLDBG

   TARGET=myapp_debug
}
win32:release {
    INCLUDEPATH += release/ui
   INCLUDEPATH += release/obj
   UI_DIR = release/ui
   MOC_DIR = release/obj/
   OBJECTS_DIR = release/obj/
   DESTDIR = release/

  TARGET=myapp
}

----------------------


Hope this helps someone, I wish someone else had posted this up earlier to save me time...

- elegant_dice
0
 

Expert Comment

by:elegant_dice
ID: 9129532
Oh, mrwad99:

I forgot to mention: one possible reason its not crashing anymore after the new memory chips might be vc++ reading from uninitialised memory...

eg:

int test_flag; // uninitialised
if ( test_flag )
   crash_me();
else
   work_normally();

before, by bad-luck test_flag would be set to !=0 and hence crash vc++.   now with the new memory chips, the system is slightly different and the bad luck has turned to good, and now test_flag happens to be set to 0 often.

Course in real life its more complex than that, but I reckon thats probably got something to do with it.

- elegant_dice
0
 
LVL 19

Author Comment

by:mrwad99
ID: 9129919
Well elegant_dice I am glad that you have got the problem sorted to a bearable level.

Interesting point you made about the memory chips too; I would not have thought of that !

Best of luck in the future.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question