-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
Title says it all. After a load of searching I came upon issue #28564 and pull request dotnet/corefx#35161 in which it states:
I am leaving the attribute on the following though:
UnmanagedType.AnsiBStr UnmanagedType.AsAny UnmanagedType.Currency UnmanagedType.TBStr UnmanagedType.VBByRefStrMy reasoning is because the BSTR ones are incredibly nuanced and cause more stress than need be and should be actively discouraged.
...
and from issue #28564:
If your application is targeting Windows and only Windows, this API is fine to use and will be around for years to come. If there are plans for your application to run on non-Windows platforms, I would suggest avoiding any API that relates to VARIANT for the time being since support on non-Windows platform is still in question.
I think that using the Obsolete attribute for this is wrong considering the intention seems to be to stop people from using it because of cross-incompatibility. Can a new attribute with a bit more explanation or intention not be built in? Or maybe at least giving a but more of a specific reason in the obsolete attribute.
It's a bit weird to support calling windows API's but mark specific feature Obsolete.
Also, the documentation of UnmanagedType at https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.unmanagedtype?view=netcore-3.0 does not mention obsolete or the reasoning behind it at all.
For anyone else looking, currently the only workaround I know of is switch off warnings for error 618
#pragma warning disable 618
//and then after the call
#pragma warning restore 618