Fix IReference for XAML TypeName#2103
Fix IReference for XAML TypeName#2103dongle-the-gadget wants to merge 1 commit intomicrosoft:staging/3.0from
Conversation
|
Fixes #2097 |
|
Thanks for the fix. We probably want to add a property that gets / sets a IReference. I expect it is going to error about nullable annotations given we don't enable it for the entire projection currently as we haven't done anything to say these reference parameters are nullable vs non nullable. So I think we might want a scoped nullable enable / disable for this parameter when it is not a value type. It probably also makes sense to port this fix to master too but I would just project it as just a type without nullable annotations enabled. |
|
Are there any other cases of WinRT value types being projected as C# reference types? If so we can hardcode |
|
I think the only other one is HResult / Exception. |
XAML.Interop.TypeNamepresents a unique challenge that the original type is a struct, but the projected type is a class (System.Type). Hence,Nullable<TypeName>is valid in WinRT context but not in C#.This PR fixes this by special casing
IReferenceto useT?syntax in C#, which works for both value types and reference types.