dotnet / dotnet/winforms

RuntimeEnvironment.GetRuntimeInterfaceAsObject is not supported

Open
#247 8 comments 0 reactions 1 assignee Claimed by @merriemcgaw View on GitHub
area-COM area-Interop area-VSTO tenet-compatibility
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
1d 13m
Merged PRs (30d)
85

Description

Running the Microsoft.DotNet.Analyzers.Compatibility, I found one occurence of API that is not supported on .NET Core.
In `ComponentManagerBroker` we call [`RuntimeEnvironment.GetRuntimeInterfaceAsObject`](https://github.com/dotnet/winforms/blob/master/src/System.Windows.Forms/src/System/Windows/Forms/ComponentManagerBroker.cs#L192). This method [throws a PlatformNotSupportedException](https://github.com/dotnet/corefx/blob/a10890f4ffe0fadf090c922578ba0e606ebdd16c/src/System.Runtime.InteropServices/src/System/Runtime/InteropServices/RuntimeEnvironment.cs#L28).

I wasn't actually capable of writing a repro. This code is hit [only in the case where there is a "native component manager" ](https://github.com/dotnet/winforms/blob/master/src/System.Windows.Forms/src/System/Windows/Forms/Application.cs#L2488). Since we're trying to retrieve a [`IMsoComponentManager`](https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2010/gg702934(v=office.14)), I'm guessing this is specific to hosting scenarios in Microsoft Office.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.