Skip to content
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

[release/8.0] Return false from ComWrappers.Try... methods #90635

Merged
merged 2 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1542,7 +1542,7 @@ private static TypeDescriptionNode NodeFor(object instance, bool createDelegator
{
type = ComObjectType;
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
else if (OperatingSystem.IsWindows()
&& ComWrappers.TryGetComInstance(instance, out nint unknown))
{
// ComObjectType uses the Windows Forms provided ComNativeDescriptor. It currently has hard Win32
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ public abstract partial class ComWrappers
{
public static unsafe bool TryGetComInstance(object obj, out IntPtr unknown)
{
throw new PlatformNotSupportedException();
unknown = default;
return false;
}

public static unsafe bool TryGetObject(IntPtr unknown, [NotNullWhen(true)] out object? obj)
{
throw new PlatformNotSupportedException();
obj = default;
return false;
}

public partial struct ComInterfaceDispatch
Expand Down