CsWinRT icon indicating copy to clipboard operation
CsWinRT copied to clipboard

Proposal: Address noisy IDisposable vtable warning

Open manodasanW opened this issue 7 months ago • 0 comments
trafficstars

Summary

When CsWinRTAotWarningLevel is set to 2, warnings are enabled for classes not marked partial that implement custom mapped interfaces given we can't generate vtables for them. Out of all the custom mapped interfaces, IDisposable seems to be a bit noisy as there are classes implementing it but not passed across the WinRT ABI compared to the other ones. We should find a way to address this.

Rationale

To allow consumers to be able to set CsWinRTAotWarningLevel to 2 by default and not be impacted by the noise.

Important Notes

There are a couple approaches:

  • If the class just implements IDisposable, maybe we should just ignore it for the warning if not partial. We will still generate the vtable if marked partial.
  • Have a property to suppress just IDisposable related warnings.
  • Have a ItemGroup that custom mapped interfaces can be added to and that indicates if a type just implements one of those interfaces, the warning should be suppressed and vtable should be generated if just that interface.

Open Questions

No response

manodasanW avatar Apr 07 '25 22:04 manodasanW