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

NinjaTrader.Core.CoreEnumConverter not found

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

    NinjaTrader.Core.CoreEnumConverter not found

    Hello,

    I am getting this exception when I try to serialize an object. The object has properties of type Brush, Stroke and SimpleFont.

    I use the XamlWrite.Save( myobject ) method to save the object.

    I am not using any EnumConverter in my class.

    The Stroke class has one enum named NinjaTrader.Gui.DashStyleHelper. Maybe the bug is there.

    Thanks.

    handlerDialogSettings_btnSave_Click Now=11:22:36
    Constructor on type 'NinjaTrader.Core.CoreEnumConverter' not found.
    at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
    at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
    at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
    at System.Xaml.TypeConverterHelper.GetTypeConverter(T ype type)
    at System.Windows.Markup.ValueSerializer.GetSerialize rFor(Type type)
    at System.Windows.Markup.ValueSerializer.GetSerialize rFor(PropertyDescriptor descriptor)
    at System.Windows.Markup.Primitives.ElementPropertyBa se.GetValueSerializer()
    at System.Windows.Markup.Primitives.ElementPropertyBa se.CanConvertToString(Object value)
    at System.Windows.Markup.Primitives.ElementProperty.g et_Value()
    at System.Windows.Markup.Primitives.ElementPropertyBa se.get_IsComposite()
    at System.Windows.Markup.Primitives.MarkupWriter.Reco rdNamespaces(Scope scope, MarkupObject item, IValueSerializerContext context, Boolean lastWasString)
    at System.Windows.Markup.Primitives.MarkupWriter.Reco rdNamespaces(Scope scope, MarkupObject item, IValueSerializerContext context, Boolean lastWasString)
    at System.Windows.Markup.Primitives.MarkupWriter.Reco rdNamespaces(Scope scope, MarkupObject item, IValueSerializerContext context, Boolean lastWasString)
    at System.Windows.Markup.Primitives.MarkupWriter.Writ eItem(MarkupObject item)
    at System.Windows.Markup.Primitives.MarkupWriter.Save AsXml(XmlWriter writer, MarkupObject item)
    at System.Windows.Markup.XamlWriter.Save(Object obj)
    at NinjaTrader.NinjaScript.AddOns.SupperiaOutputWindo w.handlerDialogSettings_btnSave_Click(Object sender, RoutedEventArgs e) in c:\Users\ROMAN\Documents\NinjaTrader 8\bin\Custom\AddOns\SupperiaOutput.cs:line 488

    #2
    It definitely looks like the bug is in the NinjaTrader.Gui.Stroke class.

    This code rises the exception:


    Code:
                Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
                Nullable<Boolean> result = dlg.ShowDialog();
                if (result.Value)
                {
                    try
                    {
                        using (Stream stream = File.Create(dlg.FileName))
                        {
                            Object o = new Stroke(Brushes.Red);
                            XamlWriter.Save( o, stream );
                        }
                    }
                    catch (Exception ex)
                    {
                        NinjaTrader.Code.Output.Process(ex.Message + Environment.NewLine + ex.StackTrace, PrintTo.OutputTab1);
                    }
                }
    (If instead Stroke class you use Brush or SimpleFont classes, the code works fine).

    Comment


      #3
      Hello,

      Thank you for the post.

      I wanted to check, are you currently ignoring the non-serializable types such as Brush and Stroke and making string properties for these to serialize within your objects properties?


      If not, I would suggest trying to comment out all of the properties and make a simple string property, then check that the serialize method works as expected. You could then use this process and uncomment one property at a time to locate what is throwing the error specifically.

      If you have a sample set up you could provide to the forum I could also try running that sample to see what I can locate.

      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment


        #4
        Sorry, maybe I should not have used the word "serialization".

        If you use XamlWriter with a Brush, the process is ok.However, if you use a Stroke, then an exception is rised.

        I am not using properties. Standard objects only.

        Attach an indicator to test it.
        Attached Files

        Comment


          #5
          Hello,

          Thank you for the clarification and sample.

          I will review this, once I have further details on this I will reply back here.

          I look forward to being of further assistance.
          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by BarzTrading, Today, 07:25 AM
          2 responses
          12 views
          1 like
          Last Post BarzTrading  
          Started by devatechnologies, 04-14-2024, 02:58 PM
          3 responses
          19 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by tkaboris, Today, 08:01 AM
          0 responses
          3 views
          0 likes
          Last Post tkaboris  
          Started by EB Worx, 04-04-2023, 02:34 AM
          7 responses
          162 views
          0 likes
          Last Post VFI26
          by VFI26
           
          Started by Mizzouman1, Today, 07:35 AM
          1 response
          9 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X