CsWinRT icon indicating copy to clipboard operation
CsWinRT copied to clipboard

CsWinRT runtime assembly and all projection assembly should disable built-in marshalling

Open Sergio0694 opened this issue 3 years ago • 0 comments

Summary

See https://learn.microsoft.com/en-us/dotnet/standard/native-interop/disabled-marshalling. CsWinRT's runtime assembly and all projection assemblies should use [assembly: DisableRuntimeMarshalling]. This would also ensure that no accidental marshalling could be triggered, as seen in the other issues around using managed signatures in function pointers and P/Invoke-s.

Rationale

  • Disabling built-in marshalling makes code more AOT-friendly
  • It also ensures that built-in marshalling isn't accidentally used, which is slower

Sergio0694 avatar Apr 16 '23 14:04 Sergio0694