Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Q:  After an entire night, Olivier and I finally found out the reason why we did not generate the full migrated code yesterday. Or, should I say, … almost.   To go straight, the trouble is (mainly) this We had a problem with line in the WpfAuthorProject routine that uses the API:

Code Block
  public static void WPFAuthorProject(int projectRoot,int commands)
   {
      int       iRoot;
      int       objType;
      tInfoFile compInfo;
      int       textRoot;
      int       oldFlags;

      Runtime.ProjectInfo(projectRoot);
      WPFRuntimeInformation();
      textRoot = Write.OpenStream();
      Runtime.ProjectAssembly(projectRoot);
      AuthorProjectAssembly(projectRoot,0);
      Runtime.AuthorLibrary(projectRoot);
      Write.CloseStream();
      compInfo = new tInfoFile(projectRoot,true);
      compInfo.tranBase = textRoot;
      oldFlags = compInfo.SetContextFlags();
      Project.prjVbname = compInfo.vbName;
      iRoot = Store.GetFirst(projectRoot);
      while(iRoot != 0)
      {
         objType = Store.GetObjectType(iRoot);
         if(objType == ObjectType.FormFile || objType == ObjectType.ModuleFile || objType == ObjectType.ClassFile)
         {
            Project.childRoot = iRoot;
            compInfo = new tInfoFile(iRoot);
            if(!compInfo.DeadCode && !compInfo.Foreign)
            {
               Write.OpenStream();
               Project.CurrentClass = compInfo.vbName;
               if(objType == ObjectType.FormFile)
               {
                  WPFAuthorControls(iRoot,0);
               }
               Runtime.TargetCode(iRoot,projectRoot,true);
               textRoot = Write.CloseStream();
               compInfo = new tInfoFile(iRoot,true) { tranBase = textRoot }; // Not Used? <------- they questioned this line; also changed to use extended constructor call syntax rather than two assignments.
            }
         }
         iRoot = Store.GetNext(iRoot);
      }
      Project.flags = oldFlags;
      Runtime.FinishTranslation(null,commands);
   }
 

...

This behavior is not really expectable expected (despite the class name, it's just constructor, no comment in the code to warn about it and we were not able to find any documentation explaining what it really does). But more than that, even once we discovered that at line 2740 of a 2750 lines code file (bad luck, after having analyzed line by line all the previous) we were not able to get a complete migration on our refactored code. We finally realized that the trouble is spread out along several instructions like this one and the effect of their combination is even more opaque and unpredictable (with some of them you get only a "half" migration – it means an incomplete bundle).

...