Skip to content

Commit 9b91a49

Browse files
authored
Fix issues with CopyToManagedArray (#2084)
* Fix issues with CopyToManagedArray * Fix test excepting int list
1 parent 9220900 commit 9b91a49

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

src/Authoring/WinRT.SourceGenerator/Helper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,9 +1068,9 @@ public static string GetCopyManagedArrayMarshaler(string type, string abiType, T
10681068
{
10691069
if (kind == TypeKind.Class || kind == TypeKind.Delegate)
10701070
{
1071-
if (type is "System.String") return "global::WinRT.MarshalString";
1071+
if (type is "System.String" || type is "string") return "global::WinRT.MarshalString";
10721072
if (type is "System.Type") return "global::ABI.System.Type";
1073-
if (type is "System.Object") return "global::WinRT.MarshalInspectable<object>";
1073+
if (type is "System.Object" || type is "object") return "global::WinRT.MarshalInspectable<object>";
10741074

10751075
if (typeFlags.HasFlag(TypeFlags.Exception))
10761076
{

src/Tests/FunctionalTests/Collections/Program.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,20 @@
187187
return 101;
188188
}
189189

190+
var typeList = new List<Type>();
191+
instance.BindableIterableProperty = typeList;
192+
if (typeList != instance.BindableIterableProperty)
193+
{
194+
return 101;
195+
}
196+
197+
var stringList = new List<string>();
198+
instance.BindableIterableProperty = stringList;
199+
if (stringList != instance.BindableIterableProperty)
200+
{
201+
return 101;
202+
}
203+
190204
var profile = Windows.Networking.Connectivity.NetworkInformation.GetInternetConnectionProfile();
191205
var names = profile?.GetNetworkNames();
192206

src/WinRT.Runtime/MatchingRefApiCompatBaseline.net8.0.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ TypesMustExist : Type 'WinRT.MarshalGenericHelper<T>' does not exist in the refe
1414
MembersMustExist : Member 'protected void ABI.WinRT.Interop.EventSource<TDelegate>..ctor(WinRT.IObjectReference, System.Int32)' does not exist in the reference but it does exist in the implementation.
1515
MembersMustExist : Member 'public void ABI.WinRT.Interop.EventHandlerEventSource<T>..ctor(WinRT.IObjectReference, System.Int32)' does not exist in the reference but it does exist in the implementation.
1616
MembersMustExist : Member 'public void ABI.WinRT.Interop.EventHandlerEventSource..ctor(WinRT.IObjectReference, System.Int32)' does not exist in the reference but it does exist in the implementation.
17-
Total Issues: 15
17+
MembersMustExist : Member 'public void ABI.System.Type.CopyManagedArray(System.Type[], System.IntPtr)' does not exist in the reference but it does exist in the implementation.
18+
Total Issues: 16

src/WinRT.Runtime/Projections/Type.ArrayMarshalling.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ internal static unsafe (int length, IntPtr data) FromManagedArray(global::System
130130
}
131131
}
132132

133-
internal static unsafe void CopyManagedArray(global::System.Type[] array, IntPtr data)
133+
public static unsafe void CopyManagedArray(global::System.Type[] array, IntPtr data)
134134
{
135135
if (array is null)
136136
{

0 commit comments

Comments
 (0)