Skip to content

Commit

Permalink
Merge pull request #157 from Brimerland/develop
Browse files Browse the repository at this point in the history
UriTypeConverter should expect absolute and relative Uris.
  • Loading branch information
cwensley authored Sep 4, 2023
2 parents 240cfd5 + 55adcb6 commit 5f11a2b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections;
using System.Globalization;
using System.Reflection;
Expand All @@ -25,7 +25,7 @@ public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo
{
var text = value as string;
if (text != null)
return new Uri(text);
return new Uri(text, UriKind.RelativeOrAbsolute);
return base.ConvertFrom (context, culture, value);
}

Expand Down
10 changes: 10 additions & 0 deletions src/Test/System.Xaml/XamlObjectWriterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,16 @@ public void Write_Uri()
}
}

[Test]
public void Write_UriRelative()
{
using (var xr = GetReader("UriRelative.xml"))
{
var des = XamlServices.Load(xr);
Assert.AreEqual(new Uri("./relative/uri", UriKind.Relative), des, "#1");
}
}

[Test]
public void Write_Null()
{
Expand Down
1 change: 1 addition & 0 deletions src/Test/XmlFiles/UriRelative.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<x:Uri xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">./relative/uri</x:Uri>

0 comments on commit 5f11a2b

Please sign in to comment.