Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Serializaton Error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Serializaton Error

    Hi,

    I'm getting the below serialization error when I try to save my workspace, but I can't figure out from that error what it is in my indicator that is causing the error. My indicator has a windows form in it, I'm guessing its got something to do with that, but is there any way to track down more accurately what the cause might be?

    Thanks,
    Will.

    2014-05-18 16:55:35:802 Gui.Chart.ChartControl.SaveToXml: indicator=NinjaTrader.Indicator.WillsBacktestAssis t: System.InvalidOperationException: Unable to generate a temporary class (result=1).
    error CS0272: The property or indexer 'NinjaTrader.Indicator.WillsBacktestAssist.CursorP osition' cannot be used in this context because the set accessor is inaccessible

    at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)
    at System.Xml.Serialization.TempAssembly.GenerateAsse mbly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)
    at System.Xml.Serialization.TempAssembly..ctor(XmlMap ping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)
    at System.Xml.Serialization.XmlSerializer.GenerateTem pAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace)
    at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
    at NinjaTrader.Cbi.XmlSerializerDictionary.get_Item(T ype type)
    at NinjaTrader.Cbi.Serializer.Serialize()
    at NinjaTrader.Gui.Chart.ChartControl.SaveToXml(XmlDo cument doc, XmlElement element, String[] elements, Boolean asTemplate)
    Last edited by dontpanic; 05-18-2014, 01:05 AM.

    #2
    Hello dontpanic,

    Thank you for your post.

    Serialization errors can occur when a property has not been serialized, this is common in colors that are user defined variables. You can find information on serializing colors at the following link: http://www.ninjatrader.com/support/f...ead.php?t=4977

    For the error CS0272, which is also in relation to properties, please visit the following link: http://msdn.microsoft.com/en-us/libr...(v=vs.90).aspx

    Comment


      #3
      Thanks,
      I was able to find the offending protected set and remove it. The code that was causing it isn't mine, I borrowed it, so I'm not 100% sure what effect the change will have. Is it possible to tell NT not to serialize that variable, as an alternative fix?

      Thanks,
      Will.

      Comment


        #4
        Hi Will, we're glad to hear that. Would suggest to look into the XmlIgnore attribute - http://msdn.microsoft.com/en-us/libr...(v=vs.90).aspx
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Thanks, XmlIgnore did the trick.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by GussJ, 03-04-2020, 03:11 PM
          11 responses
          3,228 views
          0 likes
          Last Post xiinteractive  
          Started by andrewtrades, Today, 04:57 PM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by chbruno, Today, 04:10 PM
          0 responses
          7 views
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by josh18955, 03-25-2023, 11:16 AM
          6 responses
          440 views
          0 likes
          Last Post Delerium  
          Started by FAQtrader, Today, 03:35 PM
          0 responses
          12 views
          0 likes
          Last Post FAQtrader  
          Working...
          X