-
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 all 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
2 changes: 1 addition & 1 deletion
2
src/libraries/System.Runtime.InteropServices/src/MatchingRefApiCompatBaseline.txt
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
Compat issues with assembly System.Runtime.InteropServices: | ||
TypesMustExist : Type 'System.Runtime.InteropServices.AssemblyRegistrationFlags' does not exist in the reference but it does exist in the implementation. | ||
CannotChangeAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' on 'System.Runtime.InteropServices.ComWrappers' changed from '[UnsupportedOSPlatformAttribute("android")]' in the implementation to '[UnsupportedOSPlatformAttribute("android")]' in the reference. | ||
AaronRobinsonMSFT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
TypesMustExist : Type 'System.Runtime.InteropServices.ExporterEventKind' does not exist in the reference but it does exist in the implementation. | ||
TypesMustExist : Type 'System.Runtime.InteropServices.IDispatchImplAttribute' does not exist in the reference but it does exist in the implementation. | ||
TypesMustExist : Type 'System.Runtime.InteropServices.IDispatchImplType' does not exist in the reference but it does exist in the implementation. | ||
TypesMustExist : Type 'System.Runtime.InteropServices.RegistrationClassContext' does not exist in the reference but it does exist in the implementation. | ||
TypesMustExist : Type 'System.Runtime.InteropServices.RegistrationConnectionType' does not exist in the reference but it does exist in the implementation. | ||
TypesMustExist : Type 'System.Runtime.InteropServices.SetWin32ContextInIDispatchAttribute' does not exist in the reference but it does exist in the implementation. | ||
MembersMustExist : Member 'public void System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute..ctor()' does not exist in the reference but it does exist in the implementation. | ||
CannotRemoveAttribute : Attribute 'System.CLSCompliantAttribute' exists on 'System.Runtime.InteropServices.ComTypes.IDataObject' in the implementation but not the reference. | ||
Total Issues: 9 |
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
6 changes: 4 additions & 2 deletions
6
...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
43 changes: 43 additions & 0 deletions
43
...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,43 @@ | ||
// 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 | ||
{ | ||
// Doesn't represent a real interface. The value is only used to support a call to QueryInterface for testing. | ||
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
6 changes: 4 additions & 2 deletions
6
...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.