Roslyn: Marshalling methods with `in` parameters should have [In] attribute

Created on 10 Oct 2017  路  3Comments  路  Source: dotnet/roslyn

As an optimization, compiler should place [InAttribute] if user didn't on in parameters in marshaling methods. This saves an extra copy by the run-time on method return. because right now, it is treated as an ordinary ref, and the value is copied in and out.

cc @tannergooding @jcouv

Area-Compilers Bug New Language Feature - Readonly References

Most helpful comment

@OmarTawfik Can you take this one?

All 3 comments

:memo: It's ok to fix this after 7.2, as it is an optimization. Users can manually add the [In] as a workaround (when the compiler will add it, it will be superfluous, but won't break).

@OmarTawfik Can you take this one?

Was this page helpful?
0 / 5 - 0 ratings