CsWinRT icon indicating copy to clipboard operation
CsWinRT copied to clipboard

Authored component doesn't have expected System.DateTime to Foundation.DateTime type mapping

Open Psychlist1972 opened this issue 2 years ago • 2 comments

I authored a component in C#/WinRT. It has a class which exposes a .NET DateTime property.

When I went to consume that component from C++/WinRT, it didn't work. C++ complained that it couldn't find the System.DateTime type.

My expectation was that DateTime would be mapped to a Windows::Foundation::DateTime and therefore usable from C++/WinRT.

Psychlist1972 avatar Jul 30 '22 01:07 Psychlist1972

authoring bug?

AdamBraden avatar Aug 10 '22 16:08 AdamBraden

We do have a diagnostics issue here where if System.DateTime is used, we should say it isn't a valid WinRT type. @Psychlist1972 instead of System.DateTime, can you use System.DateTimeOffset? System.DateTimeOffset is the .NET type which gets mapped to the WinRT type Windows.Foundation.DateTime.

manodasanW avatar Aug 10 '22 19:08 manodasanW