Closed bjornhoeksel closed 2 years ago
Please post an example (VCX, VCT, VC2). If not possible in open, just let me know your contact info.
Please post an example (VCX, VCT, VC2). If not possible in open, just let me know your contact info.
After converting vc2 back to vcx the vcx is missing classes and gives errors when opening in class browser ac1_dlg.VC2.txt
Running FoxBin2Prg against your VC2 never reached ignoreCorruptedObjects
Analysing your vc2 I found the following problem(s):
DEFINE CLASS ac1_msg_client_question AS ac1_msg_client OF "ac1_dlg.vcx"
DEFINE CLASS ac1_msg_send_notification AS ac1_msg_client OF "ac1_dlg.vcx"
The problem is in
If the problem is in the original lib, and the class ac1_msg_client is defined somewhere else, hack the VCX and change classloc field to the real lib file for the two records. If you dislike hacking the vcx, you might just alter the respective lines in the vc2 and recreate the vcx. Even altering the classloc to a non existing file, like DEFINE CLASS ac1_msg_client_question AS ac1_msg_client OF "ac1_dlg_x.vcx"
, will make the class available in the class browser where you might use the class browsers tools to change parent class. Anyway, all three ways are the same.
IF (NOT EMPTY(lcParentObjName))
Skip Delete Rest While Getwordnum(Lower(Parent) + '.', 1, '.') == lcParentObjName Skip -1 ENDIF
No problem is in de code below.
Scan For PLATFORM = "WINDOWS" And Empty(Parent) And Empty(RESERVED1) lcParentObjName = Lower(OBJNAME) Delete Skip Delete Rest While Getwordnum(Lower(Parent) + '.', 1, '.') == lcParentObjName Skip -1 Endscan
when I run it with new exe build with code with extra if check. then convert works fine. and all my other vcx are converting good as well without this adjustment some of our vcx end corrupted or missing classes. maybe run the code with debug with the vc2 I send before. Its difficult to send a better example. Maybe is the problem in generating vc2 I will try to send the vcx file. I think you can reproduce the problem then
Code that works: Scan For PLATFORM = "WINDOWS" And Empty(Parent) And Empty(RESERVED1) lcParentObjName = Lower(OBJNAME) Delete IF (NOT EMPTY(lcParentObjName)) Skip Delete Rest While Getwordnum(Lower(Parent) + '.', 1, '.') == lcParentObjName Skip -1 ac1_dlg.vcx.zip
ENDIF
Endscan
Ok, the problem is in converting the vcx to vc2, not the other way around. Please check the vc2 file for class ac1_msg_client, it should be there but isn't. We agree that the class is in the vcx.
The vcx seems corrupted.
Checking the vcx using USE and BROWSE, I can see there is an oddness in class ac1_msg_client. Go to Records 95 to 98
The records 95,96 are not defined, as they should be. (see the class above, any class is the record following not so unique *UniqueID=="RESERVED' to (including) the next occurrence of this ID, the order of records defines ZOrder) Deleting those two records in the vcx will create the ac1_msg_client** in the vc2, and the result of the recreation will be fine.
So maybe the change you mention removes just those two lines while creating the vc2. I have no time to follow this yet, I will check later.
Ok, the problem is in converting the vcx to vc2, not the other way around. Please check the vc2 file for class ac1_msg_client, it should be there but isn't. We agree that the class is in the vcx. The vcx seems corrupted. Checking the vcx using USE and BROWSE, I can see there is an oddness in class ac1_msg_client. Go to Records 95 to 98
The records 95,96 are not defined, as they should be. (see the class above, any class is the record following not so unique _UniqueID=="RESERVED'_* to (including) the next occurrence of this ID, the order of records defines ZOrder) Deleting those two records in the vcx will create the ac1_msg_client in the vc2, and the result of the recreation will be fine.
So maybe the change you mention removes just those two lines while creating the vc2. I have no time to follow this yet, I will check later.
Hi We have some vcx files that give problems with this code when lcParentObjName = "" and code seems to deletes random reccords in that situation. The vcx if i complile it with compile classlib i have no errors. In the comment above the problem code is the following mentioned
Procedure ignoreCorruptedObjects(lcCursor)
But for us this code creates problems and missing classes when lcParentObjName is empty. When i fix it by not keep delting if lcParentObjName is empty all works ok.
@bjornhoeksel, I understand the problem. In general, VFP is sometimes odd what works and what not. FoxBin2PRG parses the vcx as a table and assumes some things. For what ever reason, some of your VCX's are not in perfect order (do you use something non build in to work with classes?).
FoxBin2PRG just fails (without your change) to find those classes in the vcx and skip to the next class, so the class is missing in the vc2. A class not in the vc2 can not be recreated, and then you got problems.
If your fix is working, it will generate uncorrupted vcx files and all is good after first recreate. So in this sense it will repair the vcx.
I just need to think through your fix, and I need time to push it anyway. It will be done this weekend.
ℹ Computer information
📝 Provide detailed reproduction steps (if any)
After vc2 convert back to vcx class is corrupted no errors reported
problem caused by code:
Se identifican porque la clase principal el campo Reserved1 tiene vacio en vez de "Class" Local lcParentObjName, lcSetDeleted Select (lcCursor) lcSetDeleted = Set("Deleted") Set Deleted Off
Endproc
suggested fix:
Se identifican porque la clase principal el campo Reserved1 tiene vacio en vez de "Class" Local lcParentObjName, lcSetDeleted Select (lcCursor) lcSetDeleted = Set("Deleted") Set Deleted Off
Endproc
✔️ Expected result
a valid vcx with all classes
❌ Actual result
corrupt vcx missing classes. this is reported bij vfp when open in a class browser
📷 Screenshots