﻿<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type='text/css' href='https://stocksharp.com/css/style.css'?>
<?xml-stylesheet type='text/css' href='https://stocksharp.com/css/bbeditor.css'?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="html">Cannot serialize Security</title>
  <id>~/topic/1188/cannot-serialize-security/</id>
  <rights type="text">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  <updated>2026-06-08T03:49:33Z</updated>
  <logo>https://stocksharp.com/images/logo.png</logo>
  <link href="https://stocksharp.com/handlers/atom.ashx?category=topic&amp;id=1188" rel="self" type="application/rss+xml" />
  <entry>
    <id>https://stocksharp.com/posts/m/4374/</id>
    <title type="text">eaa: Mikhail Sukhov: Security.Exchange не сериализуется (добавил его позднее). Вариант - обнулите ег...</title>
    <published>2010-10-29T12:41:26Z</published>
    <updated>2010-10-29T12:41:54Z</updated>
    <author>
      <name>Mikhail Sukhov</name>
      <uri>https://stocksharp.com/users/201/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <content type="html">&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;eaa:&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Mikhail Sukhov:&lt;/strong&gt;
Security.Exchange не сериализуется (добавил его позднее). Вариант - обнулите его перед сохранение в файл.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;А фикс будет?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;В 2.5 сделан фикс. Вернее, не столько фикс, сколько улучшение сериализации торговых типов.&lt;/p&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.com/posts/m/4326/</id>
    <title type="text">Mikhail Sukhov: Security.Exchange не сериализуется (добавил его позднее). Вариант - обнулите его пер...</title>
    <published>2010-10-26T11:03:55Z</published>
    <updated>2010-10-26T11:03:55Z</updated>
    <author>
      <name>eaa</name>
      <uri>https://stocksharp.com/users/28252/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <content type="html">&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Mikhail Sukhov:&lt;/strong&gt;
Security.Exchange не сериализуется (добавил его позднее). Вариант - обнулите его перед сохранение в файл.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;А фикс будет?&lt;/p&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.com/posts/m/4321/</id>
    <title type="text">Security.Exchange не сериализуется (добавил его позднее). Вариант - обнулите его перед сохранение в ...</title>
    <published>2010-10-25T14:48:30Z</published>
    <updated>2010-10-25T14:48:30Z</updated>
    <author>
      <name>Mikhail Sukhov</name>
      <uri>https://stocksharp.com/users/201/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <content type="html">&lt;p&gt;Security.Exchange не сериализуется (добавил его позднее). Вариант - обнулите его перед сохранение в файл.&lt;/p&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
  <entry>
    <id>https://stocksharp.com/posts/m/4318/</id>
    <title type="text">Пробую сохранить Security, в доке написано что вроде как можно: [SerializableAttribute] [DataContrac...</title>
    <published>2010-10-25T09:14:20Z</published>
    <updated>2010-10-25T09:14:20Z</updated>
    <author>
      <name>eaa</name>
      <uri>https://stocksharp.com/users/28252/</uri>
      <email>info@stocksharp.com</email>
    </author>
    <content type="html">&lt;p&gt;Пробую сохранить Security, в доке написано что вроде как можно:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
[SerializableAttribute]
[DataContractAttribute]
public class Security : IExtendableEntity, INotifyPropertyChangedEx, 
	INotifyPropertyChanged

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Пишем:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
Stream stream = File.Open(Conf.securityFileName, FileMode.Create);
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(stream, security);
stream.Close();

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;А в результате получаем:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;2010-10-25 13:05:07,218 ERROR: System.Runtime.Serialization.SerializationException: Type 'Ecng.Common.NullableEx`1[[System.TimeSpan, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' in Assembly 'Ecng.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;В чем ошибка?&lt;/p&gt;
</content>
    <rights type="html">Copyright @ StockSharp Platform LLC 2010 - 2025</rights>
  </entry>
</feed>