• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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?
      http://ninjatrader.com/support/helpG...definedbrushes

      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 stefanjagger, Today, 07:47 AM
          1 response
          9 views
          0 likes
          Last Post stefanjagger  
          Started by tonynt, Today, 07:07 AM
          1 response
          7 views
          0 likes
          Last Post tonynt
          by tonynt
           
          Started by Marklhc1988, Today, 06:53 AM
          3 responses
          10 views
          0 likes
          Last Post NinjaTrader_PatrickG  
          Started by ntbone, Today, 12:05 AM
          0 responses
          10 views
          0 likes
          Last Post ntbone
          by ntbone
           
          Started by cutzpr, Yesterday, 09:33 PM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X