Click to See Complete Forum and Search --> : CRuntimeClass


Mintguy
June 14th, 2001, 10:11 AM
Hi.

I just got a beta of Visual Studio.Net from MS the other day and decided to try to compile the project I'm currently working on in this environment. I got it to compile without out too much modification.

I think there may be a bug in the latest version of MFC related to CRuntimeClass. I have an Extension Dll with about 30 MFC classes which use DECLARE_SERIAL (actually a custom version to ensure that the operator>> (CArchive& ar, class_name* &pOb) function is exported). When the dll is loaded the CRuntimeClass for each of these C++ classes adds itself to the module's registered class list in alphabetical order so that the m_pNextClass member of each CRuntimeClass points to the previously registed class. For some reason this chain of CRuntimeClass's is being broken. If I break the program execution on the call in MFC to AfxClassInit, I can see as the m_pNextClass member is updated, and I can follow all of the chained classes by looking in the watch window at this member for each class in the list. However at one particular instance if I try to follow thru the chain I can see that one of the m_pNextClass members has been reset to NULL. There is no obvious reason why this should happen. It occurs on one particular class, but if I remove the DECLARE_SERIAL & IMPLEMENT_SERIAL macros from that class I just get the same problem on another class which was behaving fine before. This behaviour doesn't occur if I compile the same code on with VC6. The result of this chain being broken is that when I try to serialize in a file saved from a VC6 build, the program cannot find some of the classes in the list of registed classes for the application (& dlls) and an error of file format invalid is generated.

Can anyone confirm whether this is a bug in VC.Net?

It may of course be a bug in my code but I don't think it is because there is nothing significantly different about the classes which break the chain, the CRuntimeClass code is mainly generated from macros and the bug doesn't manifest itself in VC6.

Any help much appreciated.

I will have to limit my evaluation of VC.Net to test projects and samples.


Eugene Gill

ArchieNet
April 26th, 2002, 03:02 PM
URGENT!

Hi Mintguy,

After 2 days of debugging, I gave up then started to search on the web concerning the bug. I found your question on codeguru. I'm very happy that isn't a bug from our side but on MFC side and I'm not alone with this problem (you have the same problem). I saw that you post this message on 6/14/01 and we are in 26/04/02. Do you have the solution now?

Thank you very much,
Sébastien

Mintguy
April 26th, 2002, 06:26 PM
Hi Sébastien.

We haven't upgraded to .Net for our projects, so this hasn't become and issue. I was using the first beta release of Visual Studio .Net for evalualtion. I was assuming that it would have been fixed in the release. I think I emailed MS about this and got no response.

Are you using the release version of Visual Studio .Net?


Hope this helps

Eugene Gill

Please take the time to reply and/or rate this answer if you found it useful.

Other readers will then be better informed.

ArchieNet
April 27th, 2002, 01:34 AM
Yes I use the release version.
Thank you

Gauss
September 26th, 2002, 07:09 AM
Hi,

:( I have the same problem with Visual C++ .NET Release version 7.095, but ONLY with DYNAMIC / DYNCREATE .

:D Instead all is right when I use DECLARE_SERIAL : the MFC AfxGetModuleState()->m_classList is populated with correct classes and the call CRuntimeClass::CreateObject(strName) is OK!

I hope this helps you.
Bye

Fabrizio

andytim
April 11th, 2003, 04:54 AM
I also have meet this problem with my project,does anyone can help me?
Urgent!!!
Urgent!!!
Urgent!!!
Urgent!!!

andytim
April 15th, 2003, 07:10 AM
Urgent!!
Who can help me?

andytim
May 8th, 2003, 01:31 AM
How to solute this problem with VC.NET 2003

andytim
May 12th, 2003, 09:34 PM
I still wait for this problem,does anyone known.

andytim
May 19th, 2003, 09:02 AM
I still wait for this problem,does anyone known.