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

Include nested types when identifying namespace dependencies #1815

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

adamrehn
Copy link

When running the WinmdUtils tool with the showNamespaceDependencies or showNamespaceCycles commands, only top-level type definitions are currently processed by the dependency search logic. Dependencies that exist in nested types are missed, as are any cyclic dependencies between namespaces that arise from them.

This pull request updates the search logic to process nested types that are enclosed within top-level type definitions for native structs and unions (both of which are represented as CLR structs in the metadata). This provides a more complete picture of the dependencies between namespaces, and exposes a number of cyclic dependencies that were not previously reported by the tool.

Here's the output of running the showNamespaceCycles command against the metadata file from the 56.0.13-preview release, using the existing search logic:

WinmdUtils> dotnet run showNamespaceCycles --winmd Windows.Win32.winmd

No cycles found between any namespaces.

Here's the output after applying the changes from this pull request:

WinmdUtils> dotnet run showNamespaceCycles --winmd Windows.Win32.winmd

Windows.Win32.Media
  Cyclical dependent namespaces: Windows.Win32.System.Ole
Windows.Win32.Security.Cryptography.Catalog
  Cyclical dependent namespaces: Windows.Win32.Security.Cryptography.Sip
Windows.Win32.Security.Cryptography.Sip
  Cyclical dependent namespaces: Windows.Win32.Security.Cryptography.Catalog
Windows.Win32.System.Com
  Cyclical dependent namespaces: Windows.Win32.System.Variant, Windows.Win32.Media, Windows.Win32.System.Ole, Windows.Win32.System.Com.StructuredStorage, Windows.Win32.System.SystemServices, Windows.Win32.UI.Controls, Windows.Win32.UI.Controls.Dialogs
Windows.Win32.System.Com.StructuredStorage
  Cyclical dependent namespaces: Windows.Win32.System.Com, Windows.Win32.System.Ole
Windows.Win32.System.Ole
  Cyclical dependent namespaces: Windows.Win32.System.Variant, Windows.Win32.System.Com
Windows.Win32.System.SystemServices
  Cyclical dependent namespaces: Windows.Win32.System.Ole, Windows.Win32.System.Com
Windows.Win32.System.Variant
  Cyclical dependent namespaces: Windows.Win32.System.Com.StructuredStorage, Windows.Win32.System.Ole, Windows.Win32.System.Com
Windows.Win32.UI.Controls
  Cyclical dependent namespaces: Windows.Win32.System.Ole, Windows.Win32.UI.Controls.Dialogs, Windows.Win32.UI.Input.Pointer
Windows.Win32.UI.Controls.Dialogs
  Cyclical dependent namespaces: Windows.Win32.System.Ole
Windows.Win32.UI.Input.Pointer
  Cyclical dependent namespaces: Windows.Win32.UI.Controls

mikebattista
mikebattista previously approved these changes Jan 16, 2024
@mikebattista
Copy link
Contributor

Thanks for the tooling change. We'll need to untangle the circular dependencies before merging otherwise builds will fail.

@mikebattista mikebattista self-assigned this Jan 16, 2024
@adamrehn
Copy link
Author

@microsoft-github-policy-service agree

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.

None yet

2 participants