You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Annotate unsupported APIs in Runtime.InteropServices #50524
As part of #47228 i am running an analyzer to detect APIs throwing PNSE but not annotated with Obsolete/SupportedOSPlatform/UnsupportedOSPlatform attributes, we need to annotate them so that developers get warnings when they use them unexpectedly
For now, I have results only cross-platform and .Net 5.0 or higher builds, analysis of targeted builds or lower env are coming soon where more APIs could be detected
Location
API
Comment
Suggestion
ExpandoToDispatchExMarshaler.cs(32,13)
'MarshalManagedToNative(object)'
unconditionally throws on all platforms
add [Obsolete]
ExpandoToDispatchExMarshaler.cs(37,13)
'MarshalNativeToManaged(IntPtr)'
unconditionally throws on all platforms
add [Obsolete]
TypeToTypeInfoMarshaler.cs(32,13)
'MarshalManagedToNative(object)'
unconditionally throws on all platforms
add [Obsolete]
TypeToTypeInfoMarshaler.cs(37,13)
'MarshalNativeToManaged(IntPtr)'
unconditionally throws on all platforms
add [Obsolete]
RuntimeEnvironment.cs(11,57)
'SystemConfigurationFile.get'
unconditionally throws on all platforms
add [Obsolete]
RuntimeEnvironment.cs(25,84)
'GetRuntimeInterfaceAsIntPtr(Guid, Guid)'
unconditionally throws on all platforms
add [Obsolete]
RuntimeEnvironment.cs(27,84)
'GetRuntimeInterfaceAsObject(Guid, Guid)'
unconditionally throws on all platforms
add [Obsolete]
Note: We are suggesting to add [Obsolete] with the corresponding message for APIs supported in .Net framework but not supported in .NetCore, if it is only supported on a specific platform(s) consider adding [SupportedOSPlatform("platformName")] or if it is unsupported on a specific platform(s) [UnsupportedOSPlatform("platformName")] attribute instead
@buyaa-n Both ExpandoToDispatchExMarshaler and TypeToTypeInfoMarshaler are now internal and not in any reference assembly. This can be verified in the official documentation as they don't show up in .NET5+.
Reacted by Buyaa Namnan
ghost added
in-prThere is an active PR which will close this issue when it is merged
Thanks, @AaronRobinsonMSFT, yes internal/private APIs are optional, I included them because they might used/referenced in public APIs and those public APIs might need further attention like being annotated with Obsolete or so
Activity
AaronRobinsonMSFT commentedon Apr 2, 2021
@buyaa-n Both
ExpandoToDispatchExMarshalerandTypeToTypeInfoMarshalerare now internal and not in any reference assembly. This can be verified in the official documentation as they don't show up in .NET5+.buyaa-n commentedon Apr 3, 2021
Thanks, @AaronRobinsonMSFT, yes internal/private APIs are optional, I included them because they might used/referenced in public APIs and those public APIs might need further attention like being annotated with Obsolete or so