-
September 28th, 2004, 02:59 AM
#1
Serialization crashing only release version! Help!
Hi!
I'm working on a mfc mdi app. I have implemented a serialization routine in order to save / open files. While it works great in Debug version (it's a pretty simple code), it crashes the app in Release version when trying to open a file.
Release version works great when saving, but you can't open a file without a crash. In fact, a file saved by the release version can be opened by the debug one.
The fun fact is that I removed all the code from the Serialize func in my CDocument derived class (except CDocumment::Serialize(ar) call) and the app still crashes!
As a note, I have checked that the crash occurs after the serialization process has finished, I can guess that when trying to show the window...
I can't find an explanation for this anywhere, so any info will be really appreciated! Thanks in advance!
-
September 28th, 2004, 03:06 AM
#2
Re: Serialization crashing only release version! Help!
Take a look at this J.Newcomer's article:Debug vs. Release
-
September 28th, 2004, 03:09 AM
#3
Re: Serialization crashing only release version! Help!
Sounds like "Help me, my code works fine in debug, but not in release. Any ideas?"... If you will not provide your code - probably nobody can help you.
The only thing I can suggest - is to add some MessageBox() calls to find a place where crash occurs. Or you can use a file to log events in. Don't forget to flush file buffer after every write.
With best wishes, Alexander Hritonenkov
-
September 28th, 2004, 03:13 AM
#4
Re: Serialization crashing only release version! Help!
1. enable the debug information on the release mode ( search the forum's FAQ for details)
2. run you app until it crahses
3. check where and why crashes
Har Har
-
September 28th, 2004, 03:14 AM
#5
Re: Serialization crashing only release version! Help!
Originally Posted by Scrambler
The only thing I can suggest - is to add some MessageBox() calls to find a place where crash occurs. Or you can use a file to log events in.
There's no need for message boxes or logfiles - you can debug a release build. Hava a look at this FAQ.
-
September 28th, 2004, 03:19 AM
#6
Re: Serialization crashing only release version! Help!
Originally Posted by gstercken
There's no need for message boxes or logfiles - you can debug a release build.
Yes, I know. But sometimes some messageboxes is a quicklier solution than debugging the release build.
And I can say more - in my current project there was a problem like this - i tried to debug release build, but every time I added the debug info, program crash disappears! So the only way was to debug it via log.
And, of course, when you developing, for example, for PocketPC - debug on remote machine is so slow...
With best wishes, Alexander Hritonenkov
-
September 28th, 2004, 03:27 AM
#7
Re: Serialization crashing only release version! Help!
Originally Posted by Scrambler
And I can say more - in my current project there was a problem like this - i tried to debug release build, but every time I added the debug info, program crash disappears!
That seems near to impossible - if you choose to use the program database for the debug info (which is the default), your object code isn't even changed - it's exactly the same like in a release build without debug info, and can't behave differently.
-
September 28th, 2004, 03:35 AM
#8
Re: Serialization crashing only release version! Help!
Originally Posted by gstercken
That seems near to impossible - if you choose to use the program database for the debug info (which is the default), your object code isn't even changed - it's exactly the same like in a release build without debug info, and can't behave differently.
Maybe it had to do with other settings, like "Optimisations".
Har Har
-
September 28th, 2004, 03:43 AM
#9
Re: Serialization crashing only release version! Help!
Wow this is pretty strange!
First of all, I loaded a previous version of the project, in which there was not any Serialization yet implemented (so loading a file has no effect over the document, which has the default constructor needed) and the problem persists.
I have tried to debug the release version, however, as far as I try to debug it, the problem dissapears (I have not placed any breakpoint). Now, run the same release version and you obtain the crash again. What does it mean? That I can't debug in order to find where the crash occurs...
I also tried the AfxMessageBox approach, but the crash seems to happen outside of my own code.
I can't really imagine where the failure can be, since all this is happening with no serialization code!!!
Anyway, thanks to all!
-
September 28th, 2004, 03:46 AM
#10
Re: Serialization crashing only release version! Help!
Try to isolate the crash as narrow as possible. What is the last thing that you do before the crash happens ( menu click, button click etc).
Har Har
-
September 28th, 2004, 03:52 AM
#11
Re: Serialization crashing only release version! Help!
As far as I try to open a previously saved file, the app crashes. The serialization code works fine, so it seems to occur when trying to show the window.
Can't imagine a solution for this...
-
September 28th, 2004, 03:53 AM
#12
Re: Serialization crashing only release version! Help!
Originally Posted by jettocrack
I have tried to debug the release version, however, as far as I try to debug it, the problem dissapears (I have not placed any breakpoint). Now, run the same release version and you obtain the crash again. What does it mean? That I can't debug in order to find where the crash occurs...
That shouldn't be a problem: While a program might behave differently when run in the debugger (different memory layout, timing etc.), you can still use just-in-time debugging. So run your app (the release build with the debug info). When it crashes, you get a message box which informs you about the problem. Click the "Debug" button in that ´message box - that will start the VC++ IDE and load your source code into the debugger, pointing at the line where the crash occured.
-
September 28th, 2004, 04:16 AM
#13
Re: Serialization crashing only release version! Help!
I'm trying this, however, since Visual Studio .NET is also installed on the computer (my project is a VS6 app), the default debugger is .NET, and don't know how to change it.
I have no idea of the .NET arch, altough it seems it's possible to debug with it...
Does anybody know how to restore VS6 as the default debugger?
-
September 28th, 2004, 05:06 AM
#14
Re: Serialization crashing only release version! Help!
Originally Posted by jettocrack
Does anybody know how to restore VS6 as the default debugger?
I'm not sure if this works (since I don't have a parallel installation) - but you could try to go to Options / Debug and turn off "Just-In-Time Debugging" (in VS7, of course).
-
September 28th, 2004, 10:12 AM
#15
Re: Serialization crashing only release version! Help!
I finally solved the problem, it was simpler than I can thought...
What I can't imagine is how the app managed to work in debug mode....
Thanks to all, can't imagine how useful your help has been!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|