Skip to content

Conversation

@Sergio0694
Copy link
Member

Title. This also simplifies code a lot.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the AsmResolver library and leverages its new auto-import functionality to significantly simplify code throughout the cswinrtgen project. The changes remove manual calls to .Import(module) across numerous files, as the updated AsmResolver version now handles imports automatically.

Key Changes:

  • Updated AsmResolver.DotNet from version 6.0.0-development.282 to 6.0.0-development.317
  • Removed all manual .Import(module) calls throughout the codebase
  • Eliminated the module parameter from several method signatures where it's no longer needed
  • Deleted the entire ImportExtensions.cs file which provided manual import helper methods

Reviewed changes

Copilot reviewed 44 out of 44 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Directory.Packages.props Updated AsmResolver.DotNet package version
InteropGenerator.Emit.cs Removed module parameter from multiple method calls
InteropGenerator.Discover.cs Removed .Import(module) calls for assembly references
WellKnownTypeDefinitionFactory.cs Removed .Import(module) calls throughout type and field definitions
WellKnownTypeDefinitionFactory.IgnoreAccessChecksToAttribute.cs Removed .Import(module) calls in attribute creation
WellKnownMemberDefinitionFactory.cs Removed module parameter from method signatures and .Import(module) calls
WellKnownCilMethodBodyFactory.cs Removed .Import(module) calls in method body construction
InteropMethodRewriteFactory.ReturnValue.cs Removed .Import(module) calls in method rewriting
InteropMethodRewriteFactory.RetVal.cs Removed .Import(module) calls in return value handling
InteropMethodDefinitionFactory.*.cs (multiple files) Removed .Import(module) calls throughout method definitions
InteropMemberDefinitionFactory.cs Removed .Import(module) calls in member creation
InteropCustomAttributeFactory.cs Removed .Import(module) calls in custom attribute creation
MethodDefinitionExtensions.cs Removed .Import(module) call in constructor creation
ImportExtensions.cs Deleted entire file containing manual import helper methods
WindowsRuntimeTypeHierarchyBuilder.cs Removed .Import(module) calls in type hierarchy construction
InteropTypeDefinitionBuilder.*.cs (multiple files) Removed module parameter from method signatures and .Import(module) calls throughout
DynamicCustomMappedTypeMapEntriesBuilder.cs Removed .Import(module) call in type resolution

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Sergio0694 Sergio0694 force-pushed the user/sergiopedri/retval-marshalling-codegen branch from d7e8792 to 1dfcb04 Compare December 2, 2025 17:36
Base automatically changed from user/sergiopedri/retval-marshalling-codegen to staging/3.0 December 2, 2025 19:16
@Sergio0694 Sergio0694 force-pushed the user/sergiopedri/asm-resolver-auto-import branch 2 times, most recently from 8394812 to 49f1f3d Compare December 2, 2025 19:23
@Sergio0694 Sergio0694 marked this pull request as ready for review December 2, 2025 19:28
Bumps the AsmResolver.DotNet package version from 6.0.0-development.282 to 6.0.0-development.317 for improved features and bug fixes.
Refactored code to eliminate redundant .Import(module) calls on type and method references throughout builder and factory classes. This simplifies the codebase and ensures references are used directly, improving maintainability and clarity.
Updated assembly reference creation to use the ImportWith method with DefaultImporter in both InteropGenerator.Discover and InteropReferences. This ensures references are properly imported into the target module context.
Introduced a new Import extension method for AssemblyReference that accepts an IResolutionScope, simplifying the import process. Updated InteropReferences to use the new method, improving code clarity and reducing direct dependency on ContextModule.DefaultImporter.
Added remarks to clarify that assembly references use the same scope as the core library type factory to ensure correct resolution. Also added comments in InteropGenerator.Discover.cs to explain the need for importing both assembly references for accurate signature comparisons during discovery.
Deleted several Import extension methods for types, methods, signatures, and member references that are no longer used. This streamlines the ImportExtensions class and removes unnecessary code.
Bumped AsmResolver.DotNet from 6.0.0-development.317 to 6.0.0-refs-pull-697-merge.322 to incorporate the latest changes and improvements.
@Sergio0694 Sergio0694 force-pushed the user/sergiopedri/asm-resolver-auto-import branch from 49f1f3d to 421756b Compare December 16, 2025 23:53
@Sergio0694 Sergio0694 marked this pull request as draft December 16, 2025 23:53
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.

2 participants