-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Enable derived COM interfaces to hide base methods with the new keyword #101577
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2756017
Enable derived COM interfaces to hide base methods
jtschuster 660e64c
Update src/libraries/System.Runtime.InteropServices/tests/ComInterfac…
jtschuster ad45e52
Update src/libraries/System.Runtime.InteropServices/gen/ComInterfaceG…
jtschuster 7755f9c
Update src/libraries/System.Runtime.InteropServices/gen/ComInterfaceG…
jtschuster 3694cd7
Remove extra usings and make snippet type partial
jtschuster e1cb878
Merge branch 'ComNonOverridingNewMethod' of https://github.com/jtschu…
jtschuster 36a4bd0
Merge branch 'main' into ComNonOverridingNewMethod
jtschuster File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
56 changes: 56 additions & 0 deletions
56
...raries/System.Runtime.InteropServices/tests/TestAssets/SharedTypes/ComInterfaces/IHide.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Runtime.InteropServices.Marshalling; | ||
|
||
namespace SharedTypes.ComInterfaces | ||
{ | ||
[GeneratedComInterface] | ||
[Guid("023EA72A-ECAA-4B65-9D96-2122CFADE16C")] | ||
internal partial interface IHide | ||
{ | ||
int SameMethod(); | ||
int DifferentMethod(); | ||
} | ||
|
||
[GeneratedComInterface] | ||
[Guid("5293B3B1-4994-425C-803E-A21A5011E077")] | ||
internal partial interface IHide2 : IHide | ||
{ | ||
new int SameMethod(); | ||
int DifferentMethod2(); | ||
} | ||
|
||
internal interface UnrelatedInterfaceWithSameMethod | ||
{ | ||
int SameMethod(); | ||
int DifferentMethod3(); | ||
} | ||
|
||
[GeneratedComInterface] | ||
[Guid("5DD35432-4987-488D-94F1-7682D7E4405C")] | ||
internal partial interface IHide3 : IHide2, UnrelatedInterfaceWithSameMethod | ||
{ | ||
new int SameMethod(); | ||
new int DifferentMethod3(); | ||
} | ||
|
||
[GeneratedComClass] | ||
[Guid("2D36BD6D-C80E-4F00-86E9-8D1B4A0CB59A")] | ||
/// <summary> | ||
/// Implements IHides3 and returns the expected VTable index for each method. | ||
/// </summary> | ||
internal partial class HideBaseMethods : IHide3 | ||
{ | ||
int IHide.SameMethod() => 3; | ||
int IHide.DifferentMethod() => 4; | ||
int IHide2.SameMethod() => 5; | ||
int IHide2.DifferentMethod2() => 6; | ||
int IHide3.SameMethod() => 7; | ||
int IHide3.DifferentMethod3() => 8; | ||
int UnrelatedInterfaceWithSameMethod.SameMethod() => -1; | ||
int UnrelatedInterfaceWithSameMethod.DifferentMethod3() => -1; | ||
} | ||
} |
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.
Uh oh!
There was an error while loading. Please reload this page.