Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
7d5c7c3
WindowsRuntimeMarshallingInfo.TryGetInfo in Type ConvertToManaged
kythant Nov 24, 2025
e4d59d9
ChkPt
kythant Nov 25, 2025
7748119
ChkPt
kythant Nov 25, 2025
ff83e55
Surgey on test cases: Will Revert
kythant Nov 25, 2025
f66b075
Add WinRT.SourceGenerator2 to UnitTest.csproj
kythant Nov 26, 2025
090f420
Remove IReference
kythant Nov 26, 2025
fa571b0
Fix typemap not being used.
manodasanW Nov 26, 2025
9f9ea00
Some unit tests
kythant Nov 27, 2025
5e99fe0
It should be AssemblyQualifiedName
kythant Nov 27, 2025
51b89c3
metadata scenario TypeMarshaling test
kythant Dec 1, 2025
3b2e3b8
ProxyType out parameter WIP
kythant Dec 2, 2025
bc5a718
CustomTypeReference GOTO
kythant Dec 2, 2025
b6fa2a4
Fix up conditions on Custom vs Metadata types
kythant Dec 2, 2025
62cf4dc
ExtractTypeName should take in ReadOnlySpan
kythant Dec 2, 2025
3879ccf
Revert "Surgey on test cases: Will Revert"
kythant Dec 2, 2025
b5746d2
Add more primitive type cases
kythant Dec 2, 2025
5161eae
Refactor/Fix trimmed metadata test
kythant Dec 3, 2025
62f26be
TODO comment
kythant Dec 3, 2025
a39b1de
comments
kythant Dec 3, 2025
066bbee
Refactor TypeMarshaller.ConvertToUnmanagedUnsafe logic
Sergio0694 Dec 3, 2025
815627d
Optimize type name slicing with JIT unrolling
Sergio0694 Dec 3, 2025
7bc9c56
Refactor TypeReference to use ReadOnlySpan<char> for Name
Sergio0694 Dec 3, 2025
2ea14e9
Add WindowsRuntimeMetadata attributes to ABI types
Sergio0694 Dec 3, 2025
0d3e4f9
Add TypeMapAssociation and WinRT metadata to ABI interfaces
Sergio0694 Dec 3, 2025
89e68a9
Improve TypeMarshaller to handle C# primitive types
Sergio0694 Dec 3, 2025
05fc31e
TestTypePropertyWithIServiceProvider()
kythant Dec 3, 2025
7c43b44
Refactor metadata type detection in marshalling info
Sergio0694 Dec 4, 2025
278fa32
Refactor TypeMarshaller to improve type kind detection
Sergio0694 Dec 4, 2025
53b0c7f
Merge branch 'user/kythant/TypeHandling' of https://github.com/micros…
kythant Dec 4, 2025
e87da3f
Tests for Timespan and CLosable
kythant Dec 4, 2025
f14aa7e
Reapply "Surgey on test cases: Will Revert"
kythant Dec 4, 2025
ca8dd48
Add back ToString()
kythant Dec 4, 2025
58f71da
Add 'WindowsRuntimeMetadataTypeNameAttribute'
Sergio0694 Dec 4, 2025
a719f84
Add 'WindowsRuntimeMetadataTypeMapGroup'
Sergio0694 Dec 4, 2025
30d7657
Add WindowsRuntimeMetadataInfo for type metadata caching
Sergio0694 Dec 5, 2025
89977a2
Clarify XML documentation in WindowsRuntimeMarshallingInfo
Sergio0694 Dec 5, 2025
415500d
Add PublicType property to WindowsRuntimeMetadataInfo
Sergio0694 Dec 5, 2025
d025fe1
Improve handling of nullable types in type marshalling
Sergio0694 Dec 5, 2025
c99bcfd
Fix merge conflict in Type.cs
kythant Dec 5, 2025
50ef998
supress IL3050:Calling members annotated with 'RequiresDynamicCodeAtt…
kythant Dec 5, 2025
ba5e619
WindowsRuntimeMetadataTypeMapGroup:
kythant Dec 5, 2025
b2c9cb8
Test cases with TestComponent and TestComponentCsharp
kythant Dec 5, 2025
a3cd499
TestComponentCsharp Class Test
kythant Dec 5, 2025
47b6af2
refactor code gen on disable and restore on IL2026
kythant Dec 5, 2025
858bd0a
Add WindowsRuntimeReferenceTypeAttribute class
Sergio0694 Dec 5, 2025
0679191
Add ReferenceType property to WindowsRuntimeMarshallingInfo
Sergio0694 Dec 5, 2025
6bb2e67
Adding WindowsRuntimeReferenceType attribute on CodeWriters.h
kythant Dec 5, 2025
88b6d3a
Merge branch 'user/kythant/TypeHandling' of https://github.com/micros…
kythant Dec 5, 2025
f4a2151
Refactor reference type handling in marshalling info
Sergio0694 Dec 5, 2025
11c2c81
Add support for metadata type name caching and retrieval
Sergio0694 Dec 5, 2025
20ab9f2
Refactor reference type handling in marshalling info
Sergio0694 Dec 5, 2025
2318cf4
Enhance Type marshalling for Windows Runtime types
Sergio0694 Dec 5, 2025
91340b6
Add WindowsRuntime type mapping attributes
Sergio0694 Dec 5, 2025
ea6c7f4
Improve runtime class name retrieval logic
Sergio0694 Dec 6, 2025
9165db5
Convert TestProperty tests to use InlineData
kythant Dec 6, 2025
ecb7f10
Merge branch 'user/kythant/TypeHandling' of https://github.com/micros…
kythant Dec 6, 2025
411f047
Handle custom-mapped interface types in TypeMarshaller
Sergio0694 Dec 6, 2025
4ffdc4e
Add WindowsRuntimeMetadataTypeMapGroup associations
Sergio0694 Dec 6, 2025
cfb46c2
Merge branch 'user/kythant/TypeHandling' of https://github.com/micros…
kythant Dec 6, 2025
684bd3c
Fix Expected result for Timespan and Type
kythant Dec 6, 2025
49d8522
Add WindowsRuntimeMetadataTypeName attribute in Object.cs
kythant Dec 6, 2025
fecf1f4
Update type map attribute to MetadataTypeMapGroup
Sergio0694 Dec 6, 2025
5558480
Remove redundant metadata attribute from Object.cs
Sergio0694 Dec 6, 2025
3faa61f
Add new TypeMapAssemblyTarget attributes
Sergio0694 Dec 6, 2025
b44e52d
Merge branch 'staging/3.0' into user/kythant/TypeHandling
Sergio0694 Dec 6, 2025
6eba922
Update ABI for INotifyDataErrorInfo to use fully qualified names
Sergio0694 Dec 6, 2025
8d4ca16
Refactor placeholder marshaller attribute implementation
Sergio0694 Dec 6, 2025
ecf418a
Refactor placeholder attribute for dynamic interface castable
Sergio0694 Dec 6, 2025
adceccf
Replace PlaceholderNullAgileReference with NullPlaceholder
Sergio0694 Dec 6, 2025
1a5a08d
Add WindowsRuntimeMappedType attributes to ABI types
Sergio0694 Dec 7, 2025
1a9d36d
Add WindowsRuntimeMappedMetadataAttribute class
Sergio0694 Dec 7, 2025
836429b
Update metadata type detection for custom-mapped types
Sergio0694 Dec 7, 2025
1ed06a9
Replace WindowsRuntimeMetadata with WindowsRuntimeMappedMetadata
Sergio0694 Dec 7, 2025
609ca5e
Rename TypeToMarshallingInfoTable to TypeToMetadataInfoTable
Sergio0694 Dec 7, 2025
c7874d8
Add metadata attributes to EventRegistrationToken struct
Sergio0694 Dec 7, 2025
eeee82b
Refactor ABI type mappings to use non-global type names
Sergio0694 Dec 7, 2025
eb18880
Refactor marshalling info retrieval for anonymous objects
Sergio0694 Jan 6, 2026
cffc5cf
Enhance TypeMarshaller with special case handling
Sergio0694 Jan 7, 2026
a573064
Improve type marshalling and remove redundant attributes
Sergio0694 Jan 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ public static void EmitPrivateProjectionsTypeMapAssemblyTargetAttributes(SourceP
{
_ = builder.AppendLine($"""
[assembly: global::System.Runtime.InteropServices.TypeMapAssemblyTarget<global::WindowsRuntime.InteropServices.WindowsRuntimeComWrappersTypeMapGroup>("{assemblyName}")]
[assembly: global::System.Runtime.InteropServices.TypeMapAssemblyTarget<global::WindowsRuntime.InteropServices.WindowsRuntimeMetadataTypeMapGroup>("{assemblyName}")]
[assembly: global::System.Runtime.InteropServices.TypeMapAssemblyTarget<global::WindowsRuntime.InteropServices.DynamicInterfaceCastableImplementationTypeMapGroup>("{assemblyName}")]
""");
}

Expand All @@ -129,6 +131,14 @@ public static void EmitDefaultTypeMapAssemblyTargetAttributes(SourceProductionCo
[assembly: global::System.Runtime.InteropServices.TypeMapAssemblyTarget<global::WindowsRuntime.InteropServices.WindowsRuntimeComWrappersTypeMapGroup>("WinRT.Interop")]
//[assembly: global::System.Runtime.InteropServices.TypeMapAssemblyTarget<global::WindowsRuntime.InteropServices.WindowsRuntimeComWrappersTypeMapGroup>("WinRT.Projection")]
[assembly: global::System.Runtime.InteropServices.TypeMapAssemblyTarget<global::WindowsRuntime.InteropServices.WindowsRuntimeComWrappersTypeMapGroup>("WinRT.Runtime2")]

[assembly: global::System.Runtime.InteropServices.TypeMapAssemblyTarget<global::WindowsRuntime.InteropServices.WindowsRuntimeMetadataTypeMapGroup>("WinRT.Interop")]
//[assembly: global::System.Runtime.InteropServices.TypeMapAssemblyTarget<global::WindowsRuntime.InteropServices.WindowsRuntimeMetadataTypeMapGroup>("WinRT.Projection")]
[assembly: global::System.Runtime.InteropServices.TypeMapAssemblyTarget<global::WindowsRuntime.InteropServices.WindowsRuntimeMetadataTypeMapGroup>("WinRT.Runtime2")]

[assembly: global::System.Runtime.InteropServices.TypeMapAssemblyTarget<global::WindowsRuntime.InteropServices.DynamicInterfaceCastableImplementationTypeMapGroup>("WinRT.Interop")]
//[assembly: global::System.Runtime.InteropServices.TypeMapAssemblyTarget<global::WindowsRuntime.InteropServices.DynamicInterfaceCastableImplementationTypeMapGroup>("WinRT.Projection")]
[assembly: global::System.Runtime.InteropServices.TypeMapAssemblyTarget<global::WindowsRuntime.InteropServices.DynamicInterfaceCastableImplementationTypeMapGroup>("WinRT.Runtime2")]
""";

context.AddSource("TypeMapAssemblyTarget.g.cs", source);
Expand Down
53 changes: 53 additions & 0 deletions src/Tests/FunctionalTests/TypeMarshaling/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.Marshalling;
using TestComponent;
using TestComponentCSharp;

bool success = true;

SetTypeProperties setTypeProperties = new();

// TODO: This test case fails because of a System.InvalidCastException when passing in CustomTestType to GetPropertyInfoWithIType.
// Reenable this once the issue is resolved.
//
//// Trimmed Metadata test case
//// Do not reference TestComponentCSharp::TestType1 in managed because it needs to be trimmed to test the Metadata TypeKind scenario
//String expectedMetadataPropertyInfo = "TestComponentCSharp.TestType1 Metadata";
//CustomTestType customTestType = new();
//if (setTypeProperties.GetPropertyInfoWithIType(customTestType) != expectedMetadataPropertyInfo)
//{
// success = false;
//}

// Custom TypeKind test case
String expectedCustomTypePropertyInfo = "CustomTestType, TypeMarshaling, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null Custom";
SetTypeProperties customSetTypeProperties = new();
if (setTypeProperties.GetPropertyInfoFromCustomType(typeof(CustomTestType)) != expectedCustomTypePropertyInfo)
{
success = false;
}

// Primitive TypeKind test case
String expectedPrimitiveTypePropertyInfo = "Int32 Primitive";
SetTypeProperties primitiveSetTypeProperties = new();
if (setTypeProperties.GetPropertyInfoFromCustomType(typeof(int)) != expectedPrimitiveTypePropertyInfo)
{
success = false;
}

// Primitive TypeKind test case 2
String expectedPrimitiveTypePropertyInfo2 = "Int64 Primitive";
SetTypeProperties primitiveSetTypeProperties2 = new();
if (setTypeProperties.GetPropertyInfoFromCustomType(typeof(System.Int64)) != expectedPrimitiveTypePropertyInfo2)
{
success = false;
}

return success ? 100 : 101;

sealed class CustomTestType : IType
{
public System.Type TypeProperty { get; set; }
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"profiles": {
"TypeMarshaling": {
"commandName": "Project",
"nativeDebugging": true
}
}
}
16 changes: 16 additions & 0 deletions src/Tests/FunctionalTests/TypeMarshaling/TypeMarshaling.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>$(FunctionalTestsBuildTFMs)</TargetFrameworks>
<Platforms>x86;x64</Platforms>
<RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers>
<PublishProfileFullPath>$(MSBuildProjectDirectory)\..\PublishProfiles\win-$(Platform).pubxml</PublishProfileFullPath>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\Authoring\WinRT.SourceGenerator2\WinRT.SourceGenerator2.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" SetPlatform="Platform=AnyCPU" />
<ProjectReference Include="..\..\..\Projections\Test\Test.csproj" />
<ProjectReference Include="..\..\..\Projections\Windows\Windows.csproj" />
</ItemGroup>

</Project>
30 changes: 30 additions & 0 deletions src/Tests/TestComponentCSharp/ManualProjectionTestClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,39 @@
#include "CustomBindableVectorTest.g.cpp"
#include "CustomBindableObservableVectorTest.g.cpp"
#include "CustomIteratorTest.g.cpp"
#include "SetTypeProperties.g.cpp"
#include <winrt/Windows.UI.Xaml.Interop.h>

namespace winrt::TestComponentCSharp::implementation
{
SetTypeProperties::SetTypeProperties()
{

}

winrt::hstring SetTypeProperties::GetPropertyInfoWithIType(IType testObject)
{
testObject.TypeProperty(winrt::xaml_typename<TestComponentCSharp::TestType1>());
winrt::hstring kind;
switch (testObject.TypeProperty().Kind)
{
case Windows::UI::Xaml::Interop::TypeKind::Custom:
kind = winrt::hstring(L"Custom");
case Windows::UI::Xaml::Interop::TypeKind::Metadata:
kind = winrt::hstring(L"Metadata");
default:
kind = winrt::hstring(L"Primitive");
}
return testObject.TypeProperty().Name + L" " + kind;
}

winrt::hstring SetTypeProperties::GetPropertyInfoFromCustomType(winrt::Windows::UI::Xaml::Interop::TypeName typeName)
{
TestComponentCSharp::Class TestObject;
TestObject.TypeProperty(typeName);
return TestObject.GetTypePropertyAbiName() + L" " + TestObject.GetTypePropertyKind();
}

CustomBindableIteratorTest::CustomBindableIteratorTest()
{

Expand Down
14 changes: 14 additions & 0 deletions src/Tests/TestComponentCSharp/ManualProjectionTestClasses.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@
#include "CustomBindableVectorTest.g.h"
#include "CustomBindableObservableVectorTest.g.h"
#include "CustomIteratorTest.g.h"
#include "SetTypeProperties.g.h"
#include <winrt/Windows.UI.Xaml.Interop.h>

namespace winrt::TestComponentCSharp::implementation
{
struct SetTypeProperties : SetTypePropertiesT<SetTypeProperties>
{
SetTypeProperties();
winrt::hstring GetPropertyInfoWithIType(IType testObject);
winrt::hstring GetPropertyInfoFromCustomType(winrt::Windows::UI::Xaml::Interop::TypeName typeName);
};

struct CustomBindableIteratorTest : CustomBindableIteratorTestT<CustomBindableIteratorTest>
{
CustomBindableIteratorTest();
Expand Down Expand Up @@ -72,6 +81,11 @@ namespace winrt::TestComponentCSharp::implementation

namespace winrt::TestComponentCSharp::factory_implementation
{
struct SetTypeProperties : SetTypePropertiesT<SetTypeProperties, implementation::SetTypeProperties>
{

};

struct CustomBindableIteratorTest : CustomBindableIteratorTestT<CustomBindableIteratorTest, implementation::CustomBindableIteratorTest>
{

Expand Down
19 changes: 19 additions & 0 deletions src/Tests/TestComponentCSharp/TestComponentCSharp.idl
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ namespace TestComponentCSharp
Int32 DrawTo();
}

interface IType
{
Windows.UI.Xaml.Interop.TypeName TypeProperty{ get; set; };
};

interface IProperties1
{
Int32 ReadWriteProperty{ get; };
Expand Down Expand Up @@ -152,6 +157,20 @@ namespace TestComponentCSharp
static ISingleton Instance;
}

[default_interface]
runtimeclass SetTypeProperties
{
SetTypeProperties();
String GetPropertyInfoWithIType(IType testObject);
String GetPropertyInfoFromCustomType(Windows.UI.Xaml.Interop.TypeName typeName);
}

// Do not reference TestComponentCSharp::TestType1 in managed because it needs to be trimmed to test the Metadata TypeKind scenario in the TypeHandling project
runtimeclass TestType1
{
void f();
}

[default_interface, gc_pressure(Windows.Foundation.Metadata.GCPressureAmount.High)]
runtimeclass Class :
Windows.Foundation.IStringable
Expand Down
119 changes: 0 additions & 119 deletions src/Tests/UnitTest/OOPObject.cs

This file was deleted.

Loading
Loading