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_Jesse
    replied
    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.

    Leave a comment:


  • cls71
    replied
    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

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    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.

    Leave a comment:


  • cls71
    replied
    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).

    Leave a comment:


  • cls71
    started a topic NinjaTrader.Core.CoreEnumConverter not found

    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

Latest Posts

Collapse

Topics Statistics Last Post
Started by chbruno, Today, 04:10 PM
0 responses
3 views
0 likes
Last Post chbruno
by chbruno
 
Started by josh18955, 03-25-2023, 11:16 AM
6 responses
436 views
0 likes
Last Post Delerium  
Started by FAQtrader, Today, 03:35 PM
0 responses
6 views
0 likes
Last Post FAQtrader  
Started by rocketman7, Today, 09:41 AM
5 responses
19 views
0 likes
Last Post NinjaTrader_Jesse  
Started by frslvr, 04-11-2024, 07:26 AM
9 responses
127 views
1 like
Last Post caryc123  
Working...
X