﻿<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type='text/css' href='https://stocksharp.ru/css/style.css'?>
<?xml-stylesheet type='text/css' href='https://stocksharp.ru/css/bbeditor.css'?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="html">xml. StockSharp</title>
  <id>https://stocksharp.ru/handlers/atom.ashx?category=tag&amp;id=xml&amp;type=community</id>
  <rights type="text">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  <updated>2026-06-13T23:34:28Z</updated>
  <logo>https://stocksharp.ru/images/logo.png</logo>
  <link href="https://stocksharp.ru/handlers/atom.ashx?category=tag&amp;id=xml&amp;type=community" rel="self" type="application/rss+xml" />
  <entry>
    <id>https://stocksharp.ru/topic/11618/</id>
    <title type="text">Не загружаются сохранённые настройки PortfolioGrid из xml</title>
    <published>2020-04-13T05:41:17Z</published>
    <updated>2020-04-16T18:53:08Z</updated>
    <author>
      <name>Дмитрий_</name>
      <uri>https://stocksharp.ru/users/62269/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <category term="xml" />
    <category term="PortfolioGrid" />
    <content type="html">&lt;p&gt;Здравствуйте.&lt;/p&gt;
&lt;p&gt;Имею контрол
&amp;lt;xaml:PortfolioGrid x:Name=&amp;quot;PortfolioGrid&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;Методы Save и Load&lt;/p&gt;
&lt;div class="spoiler"&gt;&lt;p&gt;public void Load(SettingsStorage storage)
{
if (storage != null)
{
if (storage.Contains(nameof(_testPortfolios)))
if (storage.Contains(nameof(PortfolioGrid)))
{
PortfolioGrid.Load(storage.GetValue&lt;SettingsStorage&gt;(nameof(PortfolioGrid)));
}
}
else
{
// TODO: add log
}
}&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    public void Save(SettingsStorage storage)
    {
        if (storage != null)
        {
            storage.SetValue(nameof(_testPortfolios), _testPortfolios);
            storage.SetValue(nameof(PortfolioGrid), PortfolioGrid.Save());

            new XmlSerializer&amp;lt;SettingsStorage&amp;gt;().Serialize(storage, $@&amp;quot;{_SETTINGS_DIR}/{_SETTINGS_FILE}&amp;quot;);
        }
        else
        {
            // TODO: add log
        }
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p _SETTINGS_DIR="" _SETTINGS_FILE=""&gt;Реализация методов
Load(new XmlSerializer&lt;SettingsStorage&gt;().Deserialize($@&amp;quot;/&amp;quot;));
Save(new XmlSerializer&lt;SettingsStorage&gt;().Deserialize($@&amp;quot;/&amp;quot;));&lt;/p&gt;
&lt;p&gt;C _testPortfolios всё работает
С PortfolioGrid и вариант с PortfolioGrid.Load(storage); не срабатывает&lt;/p&gt;
&lt;p&gt;Файл сохранённых настроек &lt;a href="/file/112281/historyEmulationConnectorSettings.xml"&gt;historyEmulationConnectorSettings.xml&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  <entry>
    <id>https://stocksharp.ru/topic/10576/</id>
    <title type="text">Сериализация (xml) класса Security</title>
    <published>2019-04-02T02:18:21Z</published>
    <updated>2019-04-06T19:07:57Z</updated>
    <author>
      <name>Дмитрий_</name>
      <uri>https://stocksharp.ru/users/62269/</uri>
      <email>info@stocksharp.ru</email>
    </author>
    <category term="Quik" />
    <category term="Lua" />
    <category term="Security" />
    <category term="xml" />
    <content type="html">&lt;p&gt;Добрый день
Имею Quik Lua коннектор.
Примерно 1 - 1,5 года назад сериализация класса Security проходила успешно.&lt;/p&gt;
&lt;p&gt;Провел сериализацию сегодня и получил 8  ошибок:
1 InvalidOperationException: There was an error reflecting property 'Board'.
2 InvalidOperationException: There was an error reflecting type 'StockSharp.BusinessEntities.ExchangeBoard'.
3 InvalidOperationException: There was an error reflecting property 'WorkingTime'.
4 InvalidOperationException: There was an error reflecting type 'StockSharp.Messages.WorkingTime'.
5 InvalidOperationException: There was an error reflecting property 'Periods'.
6 InvalidOperationException: There was an error reflecting type 'StockSharp.Messages.WorkingTimePeriod'.
7 InvalidOperationException: Cannot serialize member 'StockSharp.Messages.WorkingTimePeriod.SpecialDays' of type 'System.Collections.Generic.IDictionary&lt;code&gt;2[[System.DayOfWeek, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[Ecng.ComponentModel.Range&lt;/code&gt;1[[System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]][], Ecng.ComponentModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b10e79ed0227b515]]', see inner exception for more details.
8 NotSupportedException: Cannot serialize member StockSharp.Messages.WorkingTimePeriod.SpecialDays of type System.Collections.Generic.IDictionary&lt;code&gt;2[[System.DayOfWeek, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[Ecng.ComponentModel.Range&lt;/code&gt;1[[System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]][], Ecng.ComponentModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b10e79ed0227b515]] because it is an interface.&lt;/p&gt;
&lt;p&gt;Это баг или невозможность сериализации реализовано с определенной целью?&lt;/p&gt;
</content>
  </entry>
</feed>