Replies: 2 comments 2 replies
-
@FreddyD-GH native ints (nint) are not supported by WinRT which is why you are seeing the element type not supported error. Is there a WinRT type that you think it should map to? I agree that the build completing successfully is misleading. Currently the Rosyln compiler treats errors in source generators as warnings and don't break the build. Hopefully that changes in the future. |
Beta Was this translation helpful? Give feedback.
-
@manodasanW Is there an easy way to inspect .winmd files? I believe Microsoft.Windows.SDK.Win32Metadata is already creating handle types that use native ints (e.g. HWND), but I'm not sure what they are mapping it to. I'm basically looking to replicate that same behavior for my own WinRT component. |
Beta Was this translation helpful? Give feedback.
-
Whenever I try to author a WinRT component (using CsWinRT version 1.4.1), and I have a method that uses nint or System.IntPtr in the signature, the WinRT source generator breaks. The build completes successfully, and I think the output WinMD is ok, but the implementation component does not have the generated code that it needs. This is what I see in the log file:
Is there any reason IntPtr shouldn't work in this scenario? Is there perhaps some sort of alternative, equivalent type that I need to use for WinRT? Or some attribute that need to set? I am not able to find anything in the documentation about this.
Beta Was this translation helpful? Give feedback.
All reactions