The windows::Error type is not Send or Sync. This means that a windows::Result<T> is not Send or Sync either, even if T is. This is a pain both for async code, and for integrating with common error-handling frameworks like eyre and anyhow. It is possible to work around both of these issues, but they make the API considerably less ergonomic.
It looks like the problem is that Error may contain a bindings::windows::win32::winrt::IRestrictedErrorInfo. It is not clear from the documentation whether this type is supposed to by thread-safe. Could it at least be made Send? That would help with the async issue, and then by wrapping it in a Mutex you could make windows::Error Sync as well.
The
windows::Errortype is notSendorSync. This means that awindows::Result<T>is notSendorSynceither, even ifTis. This is a pain both for async code, and for integrating with common error-handling frameworks likeeyreandanyhow. It is possible to work around both of these issues, but they make the API considerably less ergonomic.It looks like the problem is that
Errormay contain abindings::windows::win32::winrt::IRestrictedErrorInfo. It is not clear from the documentation whether this type is supposed to by thread-safe. Could it at least be madeSend? That would help with the async issue, and then by wrapping it in aMutexyou could makewindows::ErrorSyncas well.