aldebaran Posted February 13, 2020 Report Share Posted February 13, 2020 Migration of properties doesn’t work. What do we have to change, for migrating successful properties?Original Code (one example of many): Property: Public Property Get Duty_lmt(ByVal iIndex As Integer) As Double Duty_lmt = mvarLmt(iIndex) End Property Public Property Let Duty_lmt(ByVal iIndex As Integer, ByVal vData As Double) mvarLmt(iIndex) = vData End Property Setting/Getting Property: For iLoop = 1 To 2 If .Duty_T1 <> NOVALUE And .Duty_T2 <> NOVALUE And .Duty_T3 <> NOVALUE And .Duty_T4 <> NOVALUE Then If iLoop = 1 Then .Duty_lmt(iLoop) = (.Duty_T1 + .Duty_T2) / 2 Else .Duty_lmt(iLoop) = (.Duty_T3 + .Duty_T4) / 2 End If Else If .Duty_T1 = NOVALUE Then .Duty_lmt(1) = .Duty_T2 Else .Duty_lmt(1) = .Duty_T1 End If If .Duty_T3 = NOVALUE Then .Duty_lmt(2) = .Duty_T4 Else .Duty_lmt(2) = .Duty_T3 End If End If .Duty_Dens(iLoop) = Densitet(.Duty_lmt(iLoop)) .Duty_Spech(iLoop) = Kapacitivitet(.Duty_lmt(iLoop)) .Duty_Cond(iLoop) = Ledntal(.Duty_lmt(iLoop)) .Duty_visk(iLoop) = Dynvisk(.Duty_lmt(iLoop)) .Duty_Pran(iLoop) = Prandtl(.Duty_lmt(iLoop)) Migrating this we get following result: Properties: public double GetLmt(int iIndex) { return mvarLmt[iIndex - 1]; } public void SetLmt(int iIndex, double value) { mvarLmt[iIndex - 1] = value; } Properties are renamed, e.g. (All Properties has in migration the same pattern, this is one of many examples): And they are mapped in a file named "ExtendedMappings.xml": <Mapping DotNetTypeName='Calculators.CoilDuty.Set' VB6MemberName='lmt'>set_lmt</Mapping> <Mapping DotNetTypeName='Calculators.CoilDuty.Get' VB6MemberName='lmt'>get_lmt</Mapping> In code both pattern are used: if (mvarDuty.T1 == CalcSupport.NOVALUE) { mvarDuty. set_lmt (1, mvarDuty.T2); } else { mvarDuty.set_lmt(1, mvarDuty.T1); } if (mvarDuty.T3 == CalcSupport.NOVALUE) { mvarDuty.set_lmt(2, mvarDuty.T4); } else { mvarDuty.set_lmt(2, mvarDuty.T3); } } mvarDuty.set_Dens(iLoop, Waterfunctions.Densitet(mvarDuty.GetGLmt(iLoop))); mvarDuty.set_Spech(iLoop, Waterfunctions.Kapacitivitet(mvarDuty.GetGetGetLmt(iLoop))); mvarDuty.set_Cond(iLoop, Waterfunctions.Ledntal(mvarDuty.GetGetGetGetLmt(iLoop))); mvarDuty.set_visk(iLoop, Waterfunctions.Dynvisk(mvarDuty.GetGetGetGetGetLmt(iLoop))); mvarDuty.set_Pran(iLoop, Waterfunctions.Prandtl(mvarDuty.GetGetGetGetGetGetLmt(iLoop))); Questions: CoilDuty (mvarDuty) does not contain a definiton for set_lmt. CoilDuty does contain a definition for SetLmt. Why set_lmt is used? What is the mapping in ExtendedMappings.xml for? Why is "GetLmt" called with growing number of "Get"? mvarDuty.set_Dens(iLoop, Waterfunctions.Densitet(mvarDuty.GetGLmt(iLoop))); mvarDuty.set_Spech(iLoop, Waterfunctions.Kapacitivitet(mvarDuty.GetGetGetLmt(iLoop))); mvarDuty.set_Cond(iLoop, Waterfunctions.Ledntal(mvarDuty.GetGetGetGetLmt(iLoop))); mvarDuty.set_visk(iLoop, Waterfunctions.Dynvisk(mvarDuty.GetGetGetGetGetLmt(iLoop))); mvarDuty.set_Pran(iLoop, Waterfunctions.Prandtl(mvarDuty.GetGetGetGetGetGetLmt(iLoop))); Link to comment Share on other sites More sharing options...
Mobilize.Net Staff OlmanQuesada Posted February 13, 2020 Mobilize.Net Staff Report Share Posted February 13, 2020 Hi Aldebaran, I created a single vb6 project with a class having a similar property definition as you indicates and it doesn't compile: The vb6 compiler doesn't like having two property methods Get and Let with parameters. Do you mind if share with me (via email) the file where Duty property is defined? Also, which version of the VBUC you're using. Regards, OlmanQ Link to comment Share on other sites More sharing options...
Members mrojas Posted February 13, 2020 Members Report Share Posted February 13, 2020 The ExtendedProperties.xml is mostly a report that the VBUC generates about some of the changes that it applies. I think it is also used by the ReflectionHelper class as an aid when trying to dynamically invoke a member. Link to comment Share on other sites More sharing options...
Mobilize.Net Staff OlmanQuesada Posted February 18, 2020 Mobilize.Net Staff Report Share Posted February 18, 2020 Hi Aldebaran, I recommend to run the migration again and running the pre-process step before We would like you to run the migration again from scratch, making sure you have all the references right and you run the preprocess. Please make sure the ADODB reference is resolved and make sure the output folder is empty before running the migration process: Go to the "Upgrade area", right click on the project and select "Preprocess Project" option, then, when the Preprocess ends, you can upgrade the code again. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now