-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Use ComWrappers in some Marshal unit-tests and update platform metadata #56595
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
AaronRobinsonMSFT
merged 11 commits into
dotnet:main
from
AaronRobinsonMSFT:runtime_56474
Aug 3, 2021
Merged
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9883336
Remove the SupportedOSPlatform attribute from the ComWrappers API.
AaronRobinsonMSFT df27842
Test the Marshal.QueryInterface, Marshal.AddRef, and Marshal.Release
AaronRobinsonMSFT e1825f7
Update ApiCompat baseline.
AaronRobinsonMSFT 455641a
Update src/libraries/shims/ApiCompat.proj
AaronRobinsonMSFT 69a125e
Missing attribute
AaronRobinsonMSFT e451558
Review feedback.
AaronRobinsonMSFT 22dc28c
Merge remote-tracking branch 'upstream/main' into runtime_56474
AaronRobinsonMSFT fa3a7f1
Merge remote-tracking branch 'upstream/main' into runtime_56474
AaronRobinsonMSFT 12e3c60
Update ApiCompat for InteropServices project.
AaronRobinsonMSFT cdc0154
Test should not run on Mono.
AaronRobinsonMSFT ac47ce3
Apply suggestions from code review
AaronRobinsonMSFT 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
5 changes: 3 additions & 2 deletions
5
...ystem.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/AddRefTests.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
42 changes: 42 additions & 0 deletions
42
...me.InteropServices/tests/System/Runtime/InteropServices/Marshal/Common/COMWrappersImpl.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,42 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Collections; | ||
using System.Runtime.CompilerServices; | ||
using Xunit; | ||
|
||
namespace System.Runtime.InteropServices.Tests.Common | ||
{ | ||
public class ComWrappersImpl : ComWrappers | ||
{ | ||
public const string IID_TestQueryInterface = "1F906666-B388-4729-B78C-826BC5FD4245"; | ||
AaronRobinsonMSFT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
protected unsafe override ComInterfaceEntry* ComputeVtables(object obj, CreateComInterfaceFlags flags, out int count) | ||
{ | ||
Assert.Equal(CreateComInterfaceFlags.None, flags); | ||
|
||
IntPtr fpQueryInterface = default; | ||
IntPtr fpAddRef = default; | ||
IntPtr fpRelease = default; | ||
ComWrappers.GetIUnknownImpl(out fpQueryInterface, out fpAddRef, out fpRelease); | ||
|
||
var vtblRaw = (IntPtr*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(ComWrappersImpl), IntPtr.Size * 3); | ||
vtblRaw[0] = fpQueryInterface; | ||
vtblRaw[1] = fpAddRef; | ||
vtblRaw[2] = fpRelease; | ||
|
||
var entryRaw = (ComInterfaceEntry*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(ComWrappersImpl), sizeof(ComInterfaceEntry)); | ||
entryRaw->IID = new Guid(IID_TestQueryInterface); | ||
entryRaw->Vtable = (IntPtr)vtblRaw; | ||
|
||
count = 1; | ||
return entryRaw; | ||
} | ||
|
||
protected override object CreateObject(IntPtr externalComObject, CreateObjectFlags flag) | ||
=> throw new NotImplementedException(); | ||
|
||
protected override void ReleaseObjects(IEnumerable objects) | ||
=> throw new NotImplementedException(); | ||
} | ||
} |
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
5 changes: 3 additions & 2 deletions
5
...stem.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReleaseTests.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
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
Oops, something went wrong.
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.