summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml
diff options
context:
space:
mode:
authorStephane Delcroix <stephane@delcroix.org>2017-06-28 20:13:09 (GMT)
committerGitHub <noreply@github.com>2017-06-28 20:13:09 (GMT)
commitd242dd70fa03fdf4c450107f467a48df64f68183 (patch)
treeecdc76cff15357885b261428c6c78a63f3169902 /Xamarin.Forms.Xaml
parent318b50aa755674c86229295611efbcacb6520fbd (diff)
downloadxamarin-forms-d242dd70fa03fdf4c450107f467a48df64f68183.zip
xamarin-forms-d242dd70fa03fdf4c450107f467a48df64f68183.tar.gz
xamarin-forms-d242dd70fa03fdf4c450107f467a48df64f68183.tar.bz2
[Xaml] Dispose string reader as soon as we're done with them (#1022)
Diffstat (limited to 'Xamarin.Forms.Xaml')
-rw-r--r--Xamarin.Forms.Xaml/XamlLoader.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Xamarin.Forms.Xaml/XamlLoader.cs b/Xamarin.Forms.Xaml/XamlLoader.cs
index 27ef06d..0f0a370 100644
--- a/Xamarin.Forms.Xaml/XamlLoader.cs
+++ b/Xamarin.Forms.Xaml/XamlLoader.cs
@@ -70,7 +70,8 @@ namespace Xamarin.Forms.Xaml
public static void Load(object view, string xaml)
{
- using (var reader = XmlReader.Create(new StringReader(xaml)))
+ using (var textReader = new StringReader(xaml))
+ using (var reader = XmlReader.Create(textReader))
{
while (reader.Read())
{
@@ -100,7 +101,8 @@ namespace Xamarin.Forms.Xaml
public static object Create (string xaml, bool doNotThrow = false)
{
object inflatedView = null;
- using (var reader = XmlReader.Create (new StringReader (xaml))) {
+ using (var textreader = new StringReader(xaml))
+ using (var reader = XmlReader.Create (textreader)) {
while (reader.Read ()) {
//Skip until element
if (reader.NodeType == XmlNodeType.Whitespace)