-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Enable derived COM interfaces to hide base methods with the new keyword #101577
Merged
Conversation
This file contains 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
jtschuster
requested review from
jkoritzinsky,
AaronRobinsonMSFT and
elinor-fung
April 25, 2024 22:30
jtschuster
changed the title
Enable derived COM interfaces to hide base methods
Enable derived COM interfaces to hide base methods with the new keyword
Apr 25, 2024
Tagging subscribers to this area: @dotnet/interop-contrib |
...raries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Tests/RcwAroundCcwTests.cs
Outdated
Show resolved
Hide resolved
…eGenerator.Tests/RcwAroundCcwTests.cs
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComMethodInfo.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComMethodInfo.cs
Show resolved
Hide resolved
This was referenced Apr 26, 2024
Closed
Closed
…enerator/ComMethodInfo.cs Co-authored-by: Aaron Robinson <arobins@microsoft.com>
jtschuster
commented
Apr 26, 2024
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComMethodInfo.cs
Outdated
Show resolved
Hide resolved
…enerator/ComMethodInfo.cs
3 tasks
cc @dotnet/appmodel |
jkoritzinsky
approved these changes
May 6, 2024
michaelgsharp
pushed a commit
to michaelgsharp/runtime
that referenced
this pull request
May 9, 2024
…rd (dotnet#101577) When a COM interface method is defined with the new keyword, we should avoid creating a new shadowing method on the derived interface, and remove the new keyword when creating implementations of methods. This change tracks whether a method was declared with the new keyword. If it was, we search all the inherited methods for one with the same name and signature. If found, we mark that method as "HiddenOnDerivedInterface". The hidden method may not be found if the method hides a non-COM method. When generating methods, we only generate new shadowing method declarations for inherited methods that aren't already hidden, and we don't generate any stubs for inherited hidden methods. The diff for the generated code for the new test interfaces is shown below. --------- Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Ruihan-Yin
pushed a commit
to Ruihan-Yin/runtime
that referenced
this pull request
May 30, 2024
…rd (dotnet#101577) When a COM interface method is defined with the new keyword, we should avoid creating a new shadowing method on the derived interface, and remove the new keyword when creating implementations of methods. This change tracks whether a method was declared with the new keyword. If it was, we search all the inherited methods for one with the same name and signature. If found, we mark that method as "HiddenOnDerivedInterface". The hidden method may not be found if the method hides a non-COM method. When generating methods, we only generate new shadowing method declarations for inherited methods that aren't already hidden, and we don't generate any stubs for inherited hidden methods. The diff for the generated code for the new test interfaces is shown below. --------- Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #101240
When a COM interface method is defined with the
new
keyword, we should avoid creating a new shadowing method on the derived interface, and remove thenew
keyword when creating implementations of methods. This change tracks whether a method was declared with thenew
keyword. If it was, we search all the inherited methods for one with the same name and signature. If found, we mark that method as "HiddenOnDerivedInterface". The hidden method may not be found if the method hides a non-COM method. When generating methods, we only generate new shadowing method declarations for inherited methods that aren't already hidden, and we don't generate any stubs for inherited hidden methods. The diff for the generated code for the new test interfaces is shown below.Test type definitions:
Diff from .NET 8 to this PR