Skip to content

Commit

Permalink
Fixes saving client session to XML. (#757)
Browse files Browse the repository at this point in the history
Fixed bug in Opc.Ua.Client.Save method.
  • Loading branch information
ejoseca authored and AlinMoldovean committed Jul 22, 2019
1 parent 07e2b80 commit de838b7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion SampleApplications/SDK/Opc.Ua.Client/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,8 @@ public void Save(string filePath, IEnumerable<Subscription> subscriptions)
settings.OmitXmlDeclaration = false;
settings.Encoding = Encoding.UTF8;

XmlWriter writer = XmlWriter.Create(new StringBuilder(filePath), settings);
FileStream stream = new FileStream(filePath, FileMode.Create);
XmlWriter writer = XmlWriter.Create(stream, settings);

SubscriptionCollection subscriptionList = new SubscriptionCollection(subscriptions);

Expand All @@ -1134,6 +1135,7 @@ public void Save(string filePath, IEnumerable<Subscription> subscriptions)
{
writer.Flush();
writer.Dispose();
stream.Dispose();
}
}

Expand Down

0 comments on commit de838b7

Please sign in to comment.