Skip to content

Commit

Permalink
Merge pull request #495 from microsoft/ujjwalchadha/345-fix-typename
Browse files Browse the repository at this point in the history
Fix TypeName.Name to return full assembly qualified type name for cus…
  • Loading branch information
ujjwalchadha authored Oct 14, 2020
2 parents 27073d6 + 74f41d1 commit f9e64eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions UnitTest/TestComponentCSharp_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ public void TestTypePropertyWithSystemType()
TestObject.TypeProperty = typeof(System.Type);
Assert.Equal("Windows.UI.Xaml.Interop.TypeName", TestObject.GetTypePropertyAbiName());
Assert.Equal("Metadata", TestObject.GetTypePropertyKind());
}

class CustomDictionary : Dictionary<string, string> { }

[Fact]
public void TestTypePropertyWithCustomType()
{
TestObject.TypeProperty = typeof(CustomDictionary);
var name = TestObject.GetTypePropertyAbiName();
Assert.Equal("UnitTest.TestCSharp+CustomDictionary, UnitTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", name);
}

#if NET5_0
Expand Down
2 changes: 1 addition & 1 deletion WinRT.Runtime/Projections/Type.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static Marshaler CreateMarshaler(global::System.Type value)

return new Marshaler
{
Name = MarshalString.CreateMarshaler(TypeNameSupport.GetNameForType(value, TypeNameGenerationFlags.None)),
Name = MarshalString.CreateMarshaler(kind == TypeKind.Custom ? value.AssemblyQualifiedName : TypeNameSupport.GetNameForType(value, TypeNameGenerationFlags.None)),
Kind = kind
};
}
Expand Down

0 comments on commit f9e64eb

Please sign in to comment.