Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logic to generate type forwarding information to ECMAXML #452

Merged
merged 1 commit into from
Jan 17, 2020
Merged

Add logic to generate type forwarding information to ECMAXML #452

merged 1 commit into from
Jan 17, 2020

Conversation

anmeng10101
Copy link
Collaborator

No description provided.

@dnfclas
Copy link

dnfclas commented Jan 6, 2020

CLA assistant check
All CLA requirements met.

@anmeng10101 anmeng10101 changed the title add logic to generate type forwarding information to ECMAXML Add logic to generate type forwarding information to ECMAXML Jan 6, 2020
@anmeng10101
Copy link
Collaborator Author

@joelmartinez

I reused the methods in FXUtils to add/remove fx to/from list.

Since the changes will be cached, I am not sure it will impact the results return by PreviouslyProcessedFXString.

Copy link
Member

@joelmartinez joelmartinez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, so in general, I would say that this code looks good ... however as discussed, there's a few improvements to the data and the algorithm:

  • Add FromVersion and ToVersion parameters ... this will help in tracking down assembly resolution issues.
  • Currently, this is using the "Update" methodology, which tries to maintain the existing XML if it already exists. This logic is difficult to maintain and prone to issues with edge cases.
  • Moving to a process more like how the MDocUpdater.MakeParameters function works would probably be ideal. The important stages in that process are as follows:
    1. return early if typeEntry.TimesProcessed > 1
      • this can be relevant when a type is forwarded in an assembly but that assembly is in the framework folder, rather than in the dependencies folder. What happens is that the same type is inevitably processed more than one time in the same framework, which can cause issues in some cases.
    2. delete the whole list if typeEntry.Framework.IsFirstFrameworkForType(typeEntry) is true
      • this lets the algorithm begin fresh without having to make a bunch of stateful decisions. Please note that this is only relevant for XML nodes that do not have user content. So because this is information that comes from the metadata, we can process it this way.
    3. prepare state data
      • This is less of a technical reason, but more for making the algorithm easier to write.
      • It begins by making a datastructure of all relevant data in the current type (in the case of make parameters, it's the list of parameters in this type instance in this framework).
      • Then it gets a list of the current XML parameters (xdata) ... again, not really a technical reason other than organization
    4. syncing state
      • with the data from the previous step, this one becomes as simplified as:
      1. If the data doesn't exist ... add it (with FrameworkAlternate)
      2. If it does exist ... add the current framework to the FrameworkAlternate parameter
    5. There's a step here in the MakeParameters method that probably isn't relevant ... this is necessary here because Parameters are kind of unique in that they have to sync with related Docs/param nodes
    6. Lastly is the processing you do on the last instance of the type when typeEntry.Framework.IsLastFrameworkForType(typeEntry) is true
      • Here you just loop through all the XML elements, and compare the FrameworkAlternate value with typeEntry.Framework.AllFrameworksWithType(typeEntry) ... if they match, then you can confidently remove the FrameworkAlternate parameter from the XML node.

@joelmartinez joelmartinez changed the base branch from marj-metadata to develop January 10, 2020 21:51
@joelmartinez
Copy link
Member

Closing and re-opening to request new build after small update in develop branch for failing unit test

Copy link
Member

@joelmartinez joelmartinez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very close :) After you address the comment, please squash your commits and this will be ready to go. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants