Update AsmResolver and use auto-import in 'cswinrtgen'#2140
Closed
Sergio0694 wants to merge 7 commits intostaging/3.0from
Closed
Update AsmResolver and use auto-import in 'cswinrtgen'#2140Sergio0694 wants to merge 7 commits intostaging/3.0from
Sergio0694 wants to merge 7 commits intostaging/3.0from
Conversation
There was a problem hiding this comment.
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
moduleparameter from several method signatures where it's no longer needed - Deleted the entire
ImportExtensions.csfile 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.
d7e8792 to
1dfcb04
Compare
Base automatically changed from
user/sergiopedri/retval-marshalling-codegen
to
staging/3.0
December 2, 2025 19:16
8394812 to
49f1f3d
Compare
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.
49f1f3d to
421756b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title. This also simplifies code a lot.